08-15-2019
Quote:
Originally Posted by
apmcd47
@NEO, I don't generally do much with JSON, and find JQ is a good tool for pretty-printing, or extracting data from a JSON file. If I wanted to manipulate JSON data, I would probably use python, just as you use PHP.
Andrew
I should probably start using Python for routine tasks more .... it time I got off my dependance on PHP in the shell and start doing more in Python, me thinks.
Thanks Andrew.
This User Gave Thanks to Neo For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello team,
I am running below command which is giving following output.
bash-3.00$ ps -eo pid,pcpu,args | sort +1n | grep -i java
12 0.0 grep -i java
8804 0.0 /opt/app/ccr/home/ccr/WebSphere/AppServer/java/bin/sparcv9/java -XX:+UnlockDiag
9241 0.0... (7 Replies)
Discussion started by: coolguyamy
7 Replies
2. Shell Programming and Scripting
Hi All,
I have a output like below values
val1=test.com
val2=10.26.208.11
val3=en1
val4=test-priv1.com
val5=192.168.3.4
val6=en2
val7=test-priv2.com
val8=192.168.4.4
val9=en3
val10=test-vip.com
val11=10.26.208.9
val12=$val3
I want to convet this output values into below... (1 Reply)
Discussion started by: kamauv234
1 Replies
3. Shell Programming and Scripting
Friends,
I am trying to convert my local server timezone EST to UTC and for which I used the TZ command, see below
$ date
Thu Dec 6 10:14:14 EST 2012
$
$ TZ=UTC date -d '10:14 EST'
Thu Dec 6 15:14:00 UTC 2012
Now I would like to have the same output in 'yyyymmdd hh:mm' format.
... (4 Replies)
Discussion started by: vivek_damodaran
4 Replies
4. Shell Programming and Scripting
Hello Experts,
Below is the record i have:
sample data attached
I want this record of each row to be in single line and there are multiple rowise unixtime mentioned e.g 11996327 , This needs to be converted to Human readdable data and time from multiple rows
Can you help me , it will be... (10 Replies)
Discussion started by: manishK
10 Replies
5. Shell Programming and Scripting
Hello everyone,
I have created a workflow that will pull down data via a RESTful API in JSON, then my code parses and modifies said data. The problem I have is that these APIs I am working with only accept XML to PUT/POST data, and I am looking for an easy way to convert my JSON file to XML.
... (2 Replies)
Discussion started by: Zaphod_B
2 Replies
6. Shell Programming and Scripting
Hello Everyone,
I have a sample file raw.txt as shown below :
Drive Bays
Bay Name : SD-2C
Number of Standby Power Supplies : 4
Number of Drive Enclosures : 12
Summary Status of Contained Modules
All... (6 Replies)
Discussion started by: rahul2662
6 Replies
7. Shell Programming and Scripting
Dear friends,
I'm getting below API result and i would like to format them with Shell scripting.
Input
"id": 9,
"description": "short desc",
"name": "test",
"name_with_namespace": "ABCD-PDFF-PLATFORM-TEST-V1 / test",
"path": "test",
"path_with_namespace":... (7 Replies)
Discussion started by: baluchen
7 Replies
8. UNIX for Beginners Questions & Answers
Hi All,
i am trying to print the solaris 11 packages in below required format, But i am unable to do that.
Current ouput :
root@abc# pkginfo -l | egrep '(BASEDIR|NAME|VERSION)' | awk '{print}'
NAME: QLogic 570x/571x Gigabit Ethernet Driver
VERSION: 11.11,REV=2009.11.11
... (7 Replies)
Discussion started by: balu1234
7 Replies
9. UNIX for Beginners Questions & Answers
This is the sample json I have pasted here. I want all the IP address strings to be converted into an array. For example "10.38.32.202" has to be converted to everywhere in the JSON. There are multiple IPs in a JSON I am pasting one sample object from the JSON. But the IPs already in an Array... (11 Replies)
Discussion started by: vinshas1
11 Replies
10. UNIX for Beginners Questions & Answers
Hi All,
i am trying to print the df -h ouput in json format. using below script.
#!/usr/bin/env bash
df -h > /tmp/sdf
nawk '{print " "$1" "$2" "$3" "$4" "$5" "$6" "}' /tmp/sdf > /tmp/sdf1
nawk 'NR==1 { for (i=1; i<=NF; i++) { f = i }}{ print $(f), $(f), $(f), $(f), ... (2 Replies)
Discussion started by: sravani25
2 Replies
LEARN ABOUT DEBIAN
jifty::json
Jifty::JSON(3pm) User Contributed Perl Documentation Jifty::JSON(3pm)
NAME
Jifty::JSON -- Wrapper around JSON
SYNOPSIS
use Jifty::JSON qw/decode_json encode_json/;
my $obj = decode_json(q! { "x": "1", "y": "2", "z": "3" } !);
my $json = encode_json($obj);
DESCRIPTION
Provides a thin wrapper around the JSON 2.xx library, which provides a frontend for JSON::XS and JSON::PP.
This module used to wrap JSON::Syck and JSON 1.xx with special-casing for outputting JSON with single quoted values. Single quotes make it
easy to simply plop JSON into HTML attributes but are in violation of the JSON spec which mandates only double quoted strings.
The old behavior is now unsupported and it is recommended that you simply HTML escape your entire blob of JSON if you are sticking it in an
HTML attribute. You can use Jifty->web->escape() to properly escape problematic characters for HTML.
FUNCTIONS
decode_json JSON, [ARGUMENT HASHREF]
encode_json JSON, [ARGUMENT HASHREF]
These functions are just like JSON's, except that you can pass options to them like you can with JSON's "from_json" and "to_json"
functions.
By default they encode/decode using UTF8 (like JSON's functions of the same name), but you can turn that off by passing "utf8 => 0" in the
options. The allow_nonref flag is also enabled for backwards compatibility with earlier versions of this module. It allows
encoding/decoding of values that are not references.
JSON is imported with the "-support_by_pp" flag in order to support all options that JSON::PP provides when using JSON::XS as the backend.
If you are concerned with speed, be careful what options you specify as it may cause the pure Perl backend to be used. Read "JSON::PP
SUPPORT METHODS" in JSON for more information.
DEPRECATED FUNCTIONS
jsonToObj JSON, [ARGUMENTS]
objToJson JSON, [ARGUMENTS]
These functions are deprecated and provided for backwards compatibility. They wrap the appropriate function above, but "croak" in Carp if
you try to set the "singlequote" option.
LICENSE
Jifty is Copyright 2005-2010 Best Practical Solutions, LLC. Jifty is distributed under the same terms as Perl itself.
perl v5.14.2 2010-12-08 Jifty::JSON(3pm)