Jump to content

json parsing with JQ not working

babadoctor
Go to solution Solved by leonfagan71,
5 minutes ago, babadoctor said:

I am using the unix program JQ

 

here is the code:

 

jq '.videos' output.json 

https://shapeshed.com/jq-json/#how-to-pretty-print-json

looked through that and this already 

https://stedolan.github.io/jq/manual/

Haven't used that before but try this:
 

jq '.videos[].url' output.json 

 

Regards,

Leon.

no matter what I do i can't parse a json file from twitch to get a certain attribute... (the url attribute)

 

can someone please help me?

 

here is an example of the JSON

https://hastebin.com/ripesuwico.json

 

prettyprinted it looks like this

 

https://hastebin.com/awejamoqar.json

 

Is this JSON even RFC compliant???? the fuck is wrong with twitch???

 

 

Videos is a correct attribute, but everything else is just kind of mangled together underneath the videos attribute. 

 

jq '.videos' output.json 

this command works printing out everything under the .videos attribute

but thats the only thing i could get to work... I want the url line on every single object

 

looks like this on one

 

"url":"https://www.twitch.tv/videos/174631661"

 

Why can't I get this to work?

 

 

 

 

 

 

 

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, leonfagan71 said:

The JSON parses fine.
http://jsonviewer.stack.hu/
pop it in that and it will parse.

What are you using to parse it? JavaScript, PHP?
please post the code you're using in order to parse it.

 

Regards,

Leon.

I am using the unix program JQ

 

here is the code:

 

jq '.videos' output.json 

https://shapeshed.com/jq-json/#how-to-pretty-print-json

looked through that and this already 

https://stedolan.github.io/jq/manual/

OFF TOPIC: I suggest every poll from now on to have "**CK EA" option instead of "Other"

Link to comment
Share on other sites

Link to post
Share on other sites

5 minutes ago, babadoctor said:

I am using the unix program JQ

 

here is the code:

 

jq '.videos' output.json 

https://shapeshed.com/jq-json/#how-to-pretty-print-json

looked through that and this already 

https://stedolan.github.io/jq/manual/

Haven't used that before but try this:
 

jq '.videos[].url' output.json 

 

Regards,

Leon.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×