I haven't figured out how to decode this JSON response

Can somebody help?

[{"word":"hello","phonetics":[{"text":"/həˈloʊ/","audio":"https://lex-audio.useremarkable.com/mp3/hello_us_1_rr.mp3"},{"text":"/hɛˈloʊ/","audio":"https://lex-audio.useremarkable.com/mp3/hello_us_2_rr.mp3"}],"meanings":[{"partOfSpeech":"exclamation","definitions":[{"definition":"Used as a greeting or to begin a phone conversation.","example":"hello there, Katie!"}]},{"partOfSpeech":"noun","definitions":[{"definition":"An utterance of “hello”; a greeting.","example":"she was getting polite nods and hellos from people","synonyms":["greeting","welcome","salutation","saluting","hailing","address","hello","hallo"]}]},{"partOfSpeech":"intransitive verb","definitions":[{"definition":"Say or shout “hello”; greet someone.","example":"I pressed the phone button and helloed"}]}]}]

I added triple backticks to your JSON to insure their quotes weren't turned into something fancy.

Here is the structure of your JSON indented, courtesy of this app ...



tidy_Harry.aia (4.5 KB)

Here's how to read the output indentation:

  • Use the Web1 JSON Decode as Dictionary block on it.
  • The outermost layer is a list, so select item 1 or use it in a for each word loop.

Following the indentation, the next layer is a dict with tags:

  • meanings (a list)
  • word (value: "hello")
  • phonetics (a list)

Which leg do you need help following down the diagram?

Sorry, I forgot to monospace my output label.
These should be easier to follow ...



tidy_Harry.aia (4.6 KB)

Wow! Thank you Adam. It will take me a while to figure out what you did here and how it works.
I am working on an educational game wherein a child can build a word and then check to see if it is a legitmate word. If it is, they would be given more info - such as the definition.

Adam - I am sure there is a more elegant way, but this is how I used your code and went on to extract word definitions. I can now incorporate this in my app. Thanks.
tidy_Harry_aumented.aia (8.1 KB)

I greeted your solution as did
the audience at the first performance of Igor Stravinsky's Rites of Spring,
with a mixture of awe and horror.

(your code) ...

(my solution)...
Capture

Thanks for showing the elegant way. My first program was written in 1963 while in grad school. I went on to work with machines where I had to put in a bootstrap loader using toggle switches and then load punched paper tape to get an operating system. Plots were made using ascii characters. There were few tools and the goals were simple. (1) make it work. (2) Don't run out off memory. (3) Make your output suitable for a model 33 teletype machine. It was great fun.
Thanks for the tools you provide.

A Digiac 3080 in high school, about 1965 or so.
IBM 7090 (MAD language) and 1620 (FORTRAN) soon after.

I once dreamed of having a model 33 TTY.

I have one more (I hope) question re. my json learning process. The first item in your make a list block is "1" . I am not sure what that does (as opposed to just starting out with "meanings").
Does the "1" indicate that the whole json is a list and the "1" tells the "list by walking key path"
to use the whole json response as a single item list? Sorry for my density.

Thanks

Yes.

I did this because examination of the original JSON text revealed an outermost , which stands for a list. albeit a single item list.

See JSON.org for the JSON spec.