Help in Long and Complicated JSON (How do I get the value which i want)

Im working with long json file but im a little confused that how to get the value which i want...

Also i asked someone but he asking for payment

Can you please help me... if anyone have some free time please look into it...

Here is a row json file...
raw.json (5.9 KB)

I want module name from every list then after that i want show name show id image url which is inside list...

Sorry im unable to explain properly
But hope you understand what i mean...



It might help to provide a json with some real data in it.

Parsing the json should be fairly straightforward using dictionary blocks

You should also be able to display this in the native listview....

1 Like

Should i need to post Real data with show title show id and image url @TIMAI2

1 Like

Some suggestions, others may improve on this....

It would help, especially if you have multi-level data.

Here is a text shredder alternative, that gives you parallel lists:


P.S. These blocks can be dragged directly into your Blocks Editor workspace.

See A way to group projects by theme - #10 by ABG
for a demo.

I think the code that @TIMAI2 proposes is a better suggestion, here I put a code based on the KIO4_DecoJson extension that is a bit more complicated to configure.

borrar_json_3.aia (584.4 KB)

For lack of real JSON for this problem, here is a generalized header-driven table extractor, that can work off arbitrary nested list and dictionary trees.

I included 3 samples:

  • a random web driven Open Trivia result
  • The OP's lazy JSON sample
  • a recalcitrant XML weather sample, that reuses headers across all levels, foiling this approach.

Sample runs:


Open Trivia JSON is well formed.
Lazy JSON sample


The lazy feeds JSON sample is as it was given to us. (Foo)



This approach falls apart in the face of XML structures that reuse tags names locally.

The blocks:

Designer



The outer procedure:


Inner procedures:

The extract_table_helper is recursive, and searches for the given headers breadth_first, before it dives into lists and dictionary sub-values.

The result table is passed as a reference parameter all the way down the recursion stack, to allow the result table to be updated whenever the last header on the headers list is encountered.

A dictionary of the current running header values is passed up and down the recursion stack.

This scheme relies on the headers being passed in major/minor order.
table_extractor.aia (6.0 KB)

Code example using the KIO4_DecoJson extension in Screen1 and the idea indicated by @TIMAI2.

p299G_DecodificaJson_ListView.aia (588.0 KB)