Questions tagged [json]
129 questions
19
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
- 303
14
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
- 403
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
8
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,765
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
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,886
6
votes
2 answers
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 URLs (for example: …
user450409
- 155
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 Zislis
- 599
5
votes
2 answers
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 = aws_iam_user.ses_smtp_user[0].name
policy = <
Jacek
- 81
- 2
- 2
- 4
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
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
4
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
- 143
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…
Braithwaite Patrick Sean
- 51
- 1
- 3
4
votes
1 answer
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 just a place-holder. I will fill those values with…
JScott
- 43
- 1
- 1
- 3
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[] |…
Isopote42
- 157