ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!

Jump to content



Photo

[sunjester tuts] Parsing JSON in Bash


  • Please log in to reply
[sunjester tuts] Parsing JSON in Bash

#1

sunjester
sunjester
    Offline
    2
    Rep
    26
    Likes

    Underwurld Admin

  • PipPipPipPip
Posts: 104
Threads: 90
Joined: Dec 27, 2018
Credits: 0
Five years registered
#1

There comes a time when you need to format some JSON in unix, in that case, use jq.

 

Install jq

sudo apt-get -y install jq

Using jq

 

So let's parse some JSON, let's use the nulled feed, first download the feed to a file

curl -s https://www.nulled.to/misc.php?action=getFeed >feed

Now let's parse some of it, let's try the home stuff

jq '.home' feed 

e6Rwmz4.png

 

so if we wanted to get the titles from the .home section of the feed

jq '.home[].title' feed

1EsHFUP.png

#!/bin/sh
curl -s https://www.nulled.to/misc.php?action=getFeed >feed
jq '.home[].title' feed
rm feed

Edited by sunjester, 02 March 2019 - 10:01 AM.

  • 0

#2

nzshooter
nzshooter
    Offline
    0
    Rep
    0
    Likes

    Lurker

Posts: 5
Threads: 0
Joined: Mar 17, 2019
Credits: 0
Five years registered
#2

allyour shit is hq


  • 0


 Users browsing this thread: and 1 guests