Questions tagged [json]

120 questions
16
votes
1 answer

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": 4096, "block_total": 8225358, …
ThatGuyOnTheNet
  • 173
  • 1
  • 1
  • 6
11
votes
3 answers

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 status servicename --output=json --plain I see…
Stanislav Ivanov
  • 323
  • 1
  • 3
  • 10
9
votes
2 answers

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 result: HTTP/1.1 200 OK Accept-Ranges:…
user749618
  • 193
  • 1
  • 5
7
votes
1 answer

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..." "VpcId": "vpc-...", …
Michael Martinez
  • 2,543
  • 3
  • 20
  • 31
7
votes
4 answers

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 request using Google Chrome's Postman extension,…
bigboy
  • 101
  • 1
  • 1
  • 4
6
votes
2 answers

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": blah, } I would like to change the value of the…
Bastien974
  • 1,824
  • 12
  • 43
  • 61
5
votes
2 answers

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 escaped - but I can't figure out how to do…
Evgeny
  • 589
  • 5
  • 10
4
votes
2 answers

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 --filters "Name=instance-state-name,Values=running"…
Roderick Day
  • 51
  • 1
  • 5
4
votes
2 answers

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…
Thomas Einwaller
  • 288
  • 1
  • 3
  • 12
4
votes
1 answer

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; listen 8180; log_format logMyServer…
3
votes
1 answer

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.BackupJobSessions.BackupJobSessions[] |…
user5525652
  • 137
  • 1
  • 4
  • 12
3
votes
1 answer

jq : Get values from children array and display on parent array

I try to get theses value : "VmDisplayName, CreationTimeUTC, EndTimeUTC, Reason, Result, State, TotalSize, BackupServerReference, BackupJobSessionReference" from this json : { "JobSessionUid":…
user5525652
  • 137
  • 1
  • 4
  • 12
3
votes
1 answer

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.hdr(0)]}' It works but when a User Agent includes…
nbari
  • 548
  • 1
  • 8
  • 25
3
votes
1 answer

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 opened socket/connection. I was wondering if it's…
GiM
  • 131
  • 1
  • 1
  • 2
3
votes
4 answers

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. Any suggestions?
Jonah Katz
  • 133
  • 1
  • 1
  • 5
1
2 3 4 5 6 7 8