Why the FUCK is json so confusing

Why the FUCK is json so confusing

Attached: 1558809776207.jpg (512x422, 29K)

Other urls found in this thread:

mangadex.org/api/manga/27484
learnxinyminutes.com/docs/json/
twitter.com/SFWRedditImages

its easy and logical
what is wrong with you
show me one confusing example

> JSON
> confusing

pick one.

mangadex.org/api/manga/27484

You literally cannot extract "chapter" because there are multiple nested chapters

idk what you're trying to get but it still all makes sense

Of course it "makes sense" because the fucking json spec is bullshit to begin with. People can write garbage like that which is unusable but still valid

How tf is json confusing?

Not JSON's fault. You can write cancer with XML as well.

It's really quite straightforward tho

Attached: 1559687076285.jpg (720x813, 36K)

This is a rare example of recursive functions being actually useful in real life.

You'll almost likely never encounter another one, so savor it.

is xml better? I prefer json over it and do not see a problem with it.

>"json is hard hurr durr"

Attached: 56226316_2088106681487708_4057445040942847835_n.jpg (766x919, 79K)

YAML MASTERRACE

>Volume 1
>Chapter 2
>The Magical Girl and the Cage of Lesbianism
Thanks, OP.

>json is complicated
zoomers are the fucking worst, please just give up now.

how do I get into json? I want to download the images of threads or online manga

learnxinyminutes.com/docs/json/

just use javascript user, it'll make everything make sense

idk what you're using but with jansson it just works:
#include
#include

int main(int argc, char **args)
{
json_error_t error;
json_t *file, *chapter_obj, *title, *value;
char *key;

if (argc < 2) {
printf("No file provided");
return 1;
}

file = json_load_file(args[1], 0, &error);
if (!file) {
printf("Json loading failed\n");
printf("Error: Line: %i, col: %i: %s\n", error.line, error.column, error.text);
return 2;
}

chapter_obj = json_object_get(file, "chapter");
if (!chapter_obj) {
printf("Error getting chapter object\n");
return 3;
}

json_object_foreach(chapter_obj, key, value) {
title = json_object_get(value, "title");
if (title)
printf("Chapter %s: %s\n", key, json_string_value(title));
}

json_decref(file);
return 0;
}

XML is worse in every way:
- harder to read by humans
- slower to parse by computers
- more data to transfer

Either get a browser plugin to parse JSON.
Or press F12 and copy-paste the JSON into the console.

why the FUCK is regex so confusing

just use a tool to help you build them. I personally like regex101.com

bookmarked, thx

Attached: 1552369564591.gif (300x424, 2.56M)

how the fuck do you find JSON confusing? are you retarded?

Just give up and find something else to do before its too late, you're clearly not good at programming

I'm 99% sure OP is retarded. Or maybe he was brainwashed by the XML gang.

>- harder to read by humans
That's just factually incorrect.
But the other two are more important.

>hash tables are confusing
you might be in the wrong line of work user.

Seems easy enough with jq and a simple select. What are you trying to extract and in what context?