Skip to main content

Questions tagged [json]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
18 votes
1 answer
75k views

Loop over Ansible variable array in Jinja2 template

when Ansible gathers facts about hosts, it for example gets all the mounts of the host: "ansible_mounts": [ { "block_available": 7800291, "block_size": ...
ThatGuyOnTheNet's user avatar
14 votes
3 answers
18k views

How get systemd status in json format?

I want to get service status details (Loaded, enabled, active, running, since, Main PID) in machine readable form and I know that systemd tools have --output=json option, but if I do: systemctl ...
Stanislav Ivanov's user avatar
9 votes
2 answers
5k views

Can I alias all directory requests to a single file in nginx?

I'm trying to figure out how to take all requests made to a particular directory and return a json string without a redirect, in nginx. Example: curl -i http://example.com/api/call1/ Expected ...
user749618's user avatar
8 votes
1 answer
16k views

How to tell jq to print the content of two keys for each instance returned by aws ec2 cli

running aws ec2 describe-instances will return a json text similar to the following: { "Reservations": [ { "Instances": [ "PublicDnsName": "ec2..." ...
Michael Martinez's user avatar
7 votes
4 answers
21k views

What's wrong with this HTTP POST request?

I'm trying to fuzz a server using the Sulley fuzzing framework. I observe the following stream in Wireshark. The error talks about a problem with JSON parsing, however, when I try the same HTTP POST ...
bigboy's user avatar
  • 101
6 votes
2 answers
20k views

Manipulate JSON in bash

I have a JSON file I need to update a particular value. { "Comment": "comment", "test": { "enabled": true }, "enabled": true, "otherStuff": blah, "otherStuff2": blah, "otherStuff3": ...
Bastien974's user avatar
  • 1,916
5 votes
2 answers
18k views

Terraform: How to dynamically generate a block of a JSON policy?

I have the following resource: resource "aws_iam_user_policy" "ses_send_policy" { count = var.enabled ? 1 : 0 name_prefix = var.user_policy_name_prefix user = ...
Jacek's user avatar
  • 83
5 votes
2 answers
12k views

How do I Generate a Bearer Token for cURL to Get Thru IAP (GCP)?

I need to cURL a web app hosted behind IAP on GCP. Normally, users log in through IAP and use the web app, but I need to run some cURL commands (interactive and non-interactive) that hit the web app ...
user450409's user avatar
5 votes
2 answers
6k views

How to escape or remove double quotes in rsyslog template

I want rsyslog to write log messages in JSON format, which requires to use double-quotes (") around strings. Problem is that values sometime include double-quotes themselves, and those need to be ...
Evgeny Zislis's user avatar
4 votes
4 answers
49k views

Fatal error: Call to undefined function json_encode() ..?

Im trying to use json with php and i keep getting the error PHP Fatal error: Call to undefined function json_encode() I am using php version 5.3.6 and on phpinfo(); nothing mentions json. ...
Jonah Katz's user avatar
4 votes
1 answer
23k views

Building List of JSON Objects in Ansible

I'm trying to build an array/list of JSON objects in Ansible. My playbook is called by specifying --extra-vars "userids=123456,654321". I then try to build the list with the following. "TBD" is ...
JScott's user avatar
  • 43
4 votes
2 answers
18k views

IOException: Socket read failed using Apache 2, mod_jk and Tomcat over AJP

I am getting the following Exception from time to time when my users are connecting with their Android devices to out JSON Rest Service: java.io.IOException: Socket read failed at org.apache....
Thomas Einwaller's user avatar
4 votes
1 answer
7k views

nginx loggin $request_body produces weird encoding

I have an nginx server that logs POST $request_body to a file. When I post json to the server, it replaces quotes (") with \x22. My config looks like this server { server_name myServer; ...
Braithwaite Patrick Sean's user avatar
4 votes
2 answers
9k views

awcli query option for multiple filter expressions

Given the output of aws ec2 describe instances I am trying to display objects that have no Platform value and DO have a VpcId value. So far I have come up with this: aws ec2 describe-instances --...
Roderick Day's user avatar
3 votes
1 answer
5k views

jq sort by date (iso 8601)

I try to sort json by date (field CreationTimeUTC) in iso 8601 format with jq 1.5. I found this post, but that return : 'Cannot index boolean with string "CreationTimeUTC"' jq '.Entities....
Isopote42's user avatar
  • 157
3 votes
1 answer
7k views

jq : Get values from children array and display on parent array [closed]

I try to get theses value : "VmDisplayName, CreationTimeUTC, EndTimeUTC, Reason, Result, State, TotalSize, BackupServerReference, BackupJobSessionReference" from this json : { "JobSessionUid": "...
Isopote42's user avatar
  • 157
3 votes
1 answer
2k views

How to escape only quotes in haproxy log format

I am capturing the user-agent using: http-request capture req.hdr(User-Agent) len 192 And then trying to create a custom JSON log format like this: log-format '{"User-Agent":%{+Q,+E}[capture.req....
nbari's user avatar
  • 568
3 votes
1 answer
15k views

multiple post requests using wget and same base-url

wget has nice option that lets you allow downloading multiple files from same location (I mean combination of --base and --input-file) Advantage of this, is that if possible wget tries to reuse ...
GiM's user avatar
  • 131
2 votes
3 answers
10k views

Output IPaddress of VM using ARM template

Have a ARM template (https://github.com/jmspring/arm-template-neo4j-docker/blob/master/azuredeploy.json) which will launch a instance and assign a public IP. here i need to print the IP address as ...
mebb's user avatar
  • 29
2 votes
5 answers
4k views

Will firewalls block my non-HTTP network protocol even if I use TCP port 80?

I want to create a simple JSON-based protocol to allow my game to talk to my custom server, but I don't want embed it in HTTP. If I send a custom text-based protocol request to my server on port 80, ...
MindJuice's user avatar
2 votes
3 answers
5k views

How to retrieve the routing tables in JSON format (linux)?

The ip command is able to return some of its results in JSON format, but it seems to be unable to format the routing table(s). Here are some examples of what I mean. List of all addresses: ip --json ...
Alessio Periloso's user avatar
2 votes
1 answer
472 views

Create JSON Patch 6902 from two yaml/json files

Imagine I have a file foo.yaml and a modified version of this file called foo2.yaml. Is there a way to create a correspondig json patch 6902?
guettli's user avatar
  • 3,893
2 votes
1 answer
3k views

Convert JSON to CSV-BASH

JSON file: "UserDetailList": [ { "UserName": "citrix-xendesktop-ec2-provisioning", "GroupList": [], "CreateDate": "2017-11-07T14:20:14Z", "...
Milister's user avatar
  • 173
2 votes
1 answer
2k views

json_query help - not producing expected output

I am trying to build an array to use for with_nested, but I cannot get past why json_query isn't outputting the actual hosts assigned to each cluster: Play: - name: Index clusters.json shell: cat {{ ...
BrillCom's user avatar
  • 149
2 votes
2 answers
10k views

Run bash command with json parameters from jq

How can I run a bash command for every json object in a json array using jq? So far I have this: cat credentials.json | jq -r '.[] | .user, .date, .email' | mycommand -u {user} -d {date} -e {email} ...
danielrvt's user avatar
  • 239
2 votes
1 answer
961 views

ansible custom facts returning string not array

I have a custom fact for my servers to retrieve customer data. This works fine on the machine and returning valid json. I can write the output to another facts-file and this works perfectly fine too. ...
Timo's user avatar
  • 143
2 votes
2 answers
550 views

Knife not parsing JSON variable in PowerShell

I am trying to create an amazon EC2 instance using "knife ec2 server create" and passing in JSON to override the default settings by using the -j option where $json is properly formed JSON text and I ...
Neil Simon's user avatar
2 votes
1 answer
1k views

How to read docker json log files in a readable format?

I always back up docker json log files when I deploy a new image version. Is there a linux program or command that lets me browse the log output from backed-up json log files in a readable format ...
Mise's user avatar
  • 23
2 votes
2 answers
6k views

Ansible parsing a JSON output

I'm using URI in order to get a JSOn output to a register called "vchosts" TASK [debug] ****************************************************************************************************************...
Vidanez's user avatar
  • 21
2 votes
0 answers
1k views

Lunajson not found in lua 5.2.3

I have installed lunajson with luarocks. When I attempt to use the module I keep getting the error below. I am just trying to decode a website that responds back with some json. The OS is running ...
user2236794's user avatar
2 votes
0 answers
4k views

Parsing JSON event in Logstash

I have log in following format, it is a plain json with nested fields. { "level": "info", "message": { "req": { "headers": { "host": "localhost:8080", ...
vkpro's user avatar
  • 21
2 votes
0 answers
47 views

AWS-Hadoop Data Analytics Implementation for Multiple JSON Files

I am new to hadoop and AWS. I have setup multi-node (4 instances t2.large) AWS EC2 cluster with cloudera Hadoop distribution. I have tested the environment with basic examples using CSV files such as ...
Rash's user avatar
  • 21
2 votes
1 answer
1k views

Chef: Load Attributes from encrypted databag in json role

I'm want to use the postfix cookbook for chef. The sasl password is expected to be in an attribute. So usually you would do this: "default_attributes": { "postfix": { "sasl": { "...
jcvj's user avatar
  • 33
2 votes
0 answers
847 views

PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/json.so' undefined symbol: ZVAL_DELREF [duplicate]

I have an issue where I am unable to use JSON, which would appear to be because of the following error. There is another thread on this forum this touches on a similar issue, but it's not quite the ...
crmpicco's user avatar
  • 251
1 vote
2 answers
10k views

Powershell - Split Array Value keep first element

I'm trying to extract just the IPs from a filtered JSON using the following code: $curl = Invoke-WebRequest -Method Get -Uri "http://urltojson.com/file.json" $curl2 = $curl.Content.replace(&...
joebegborg07's user avatar
1 vote
1 answer
7k views

Using Zabbix to record JSON output from REST api? is it possible

I'm trying to use Zabbix (5.0) to capture the response from a REST API. If I paste the following into a webbrowser (or wget / curl etc) http://{username}:{password}@10.1.2.3:8443/api/metadata/ I get ...
IGGt's user avatar
  • 135
1 vote
1 answer
2k views

Nginx removes post data with content-type header

I am making posts like this: curl 'http://localhost/api.php' -H 'Content-Type: application/json' --data 'names=[{"name":"name"}]' Which results in the post data being deleted. If ...
Kohjah Breese's user avatar
1 vote
3 answers
9k views

Date field is being presented as integer

I have an Elastic Stack server (on Hyper-v) that is ingesting data via a logstash exec command and performing analytics on it. Everything is working great except a date field that is being displayed ...
Elliot Huffman's user avatar
1 vote
1 answer
3k views

sending json based messages using syslog-ng and amqp

How do you properly format json messages and send them over amqp with syslog-ng? The json format should look something like this. {"log":"This is the error message...", "date":"xxx", "source":"xxx"} ...
eandersson's user avatar
1 vote
1 answer
3k views

Download |parse pem file aws secret manager

I have placed pem file as a key value on AWS Secret Manager. When I downloaded the pem file it downloaded as following format. -----BEGIN RSA PRIVATE KEY-----EncryptedText==-----END RSA PRIVATE KEY --...
Vikash's user avatar
  • 151
1 vote
1 answer
314 views

Update JSON Payload using Powershell and Nutanix API

I'm currently writing a script that allow to update Nutanix VM Categories. Categories format is key:value and a VM may have no categories, 1 or multiple. Process to do that is quite simple : first I ...
motorbass's user avatar
  • 363
1 vote
1 answer
3k views

Append JSON dictonaries

I am using ansible 2.9 and cannot lookout for a way to append below JSON structure with data "Variables":[ { "Strings": [ "abc", "...
AniK's user avatar
  • 13
1 vote
1 answer
1k views

failed to recognize JSON request: 'EOF'

I'm trying to use a Rest API, but when I query, I receive the following error that I don't understand, I've tried to look at similar questions here but they are very particular cases. This is the code ...
minu's user avatar
  • 11
1 vote
1 answer
715 views

Storage profile error when deploying new machine using json template

I'm trying to deploy two vm's in an avset using visual studio 2015. I get the error message below when I attempt to deploy: New-AzureRmResourceGroupDeployment : 2:03:59 AM - Resource Microsoft....
Norrin Rad's user avatar
1 vote
1 answer
3k views

Error when deploying JSON template

I'm trying to deploy two VMs in an avset using Visual Studio 2015. I get the error message below when I attempt to deploy: Reference Id 1 is not formatted correctly. The Id is expected to reference ...
Norrin Rad's user avatar
1 vote
1 answer
1k views

JSON parsing with Nagios plugin

I am looking to use Drew Kerrigan's JSON Nagios plugin on GitHub (drewkerrigan/nagios-http-json) to monitor the output from a REST API, but I am struggling to get the query syntax right. Here is a ...
Linker3000's user avatar
1 vote
1 answer
28k views

package org.json does not exist

I downloaded the JSON library for Java from Maven Repo and installed the .JAR file at the Java library directory on UBuntu 14.04. I tried compile a simple JAVA snippet for JSON parsing, but the ...
ivanleoncz's user avatar
  • 1,761
1 vote
2 answers
88 views

Linux program used to gather installed packages, processes, listening ports, etc.?

It's hard to Google this because it seems like everyone and their kid sister has written a script to gather system stats! I once saw a mature program written that is used to gather system stats like ...
Synthead's user avatar
  • 131
1 vote
1 answer
748 views

How to substitute a string from an awk result?

I have a JSON file which contain multiple occurrence of replaceme. I only want to substitute an occurrence based on a specific string found a few line above. E.g., [...] "title" : { "...
Bastien974's user avatar
  • 1,916
1 vote
1 answer
813 views

Issues with converting JSON to CSV with nested values

So far I have had no problems converting standard JSON to CSV with jq in the past. But now my data becomes complicated. Major base tags are account and subaccount. All other values are variables. The ...
safect's user avatar
  • 13