How do I view list view elements from json file?


help to view list view elements from json file how can i view this json file in listview elemtents with blocks?

Use the Web component's JsonTextDecode block to convert the JSON string into a list.

Dictionary lookup in pairs

Which ones do you want?

The main, the optional, or both?

For blocks, post the JSON text inline as text so we can test using it.

Why not use the JsonTextDecodeWithDictionaries then use the dictionary blocks to parse the data ?

1 Like

You are absolutely correct.

Both i want to display

I trued alot but i cant reach.. can you help me with blocks

Afrer decoding and show in text ...jow can dosplay data from that text to list view ?what is the blocks to show both optional and main

You need to paste the json here for solution. But before this show us first what you've tried.

Could you type into your next post exactly how the result should look like for that data, in the ListViewer?

Add extra blank lines between one Element and the next, for clarity.

image

the second argument to foreach isn`t alist .....the error :frowning:

the ressult will be like that each one (name and code) in element in list view:

"fundamental-code": "T4"
"fundamental-name": "physics"

"fundamental-code": "F5F",
"fundamental-name": "chemistry",

"optional-code": "M20",
"optional-name": " pesentation Skills

file json:

{
    "main": 
[
        {
            "fundamental-code": "T4",
            "fundamental-name": "physics",
            
        },
        {
            "fundamental-code": "F5F",
            "fundamental-name": "chemistry",
            
        },
        
    "Optional": [
        {
            "optional-code": "T4",
            "optional-name": "math",
           
        },
        {
            "optional-code": "M20",
            "optional-name": "  pesentation Skills",
         
        }
    ],
    "No of Required optional courses": [
        {
            "Number of required optional courses": 2
        }
    ]
}

json file:

{
    "main": 
[
        {
            "fundamental-code": "T4",
            "fundamental-name": "physics",
            
        },
        {
            "fundamental-code": "F5F",
            "fundamental-name": "chemistry",
            
        },
        
    "Optional": [
        {
            "optional-code": "T4",
            "optional-name": "math",
           
        },
        {
            "optional-code": "M20",
            "optional-name": "  pesentation Skills",
         
        }
    ],
    "No of Required optional courses": [
        {
            "Number of required optional courses": 2
        }
    ]
}

i want code and name in element in list view

Show us what did you try

What happened to T4 math?
Did you intend for it to be missed in the output sample?


If you want to extract this type of json without any Json Extension then here is the solution. It took my 15 minutes.