AnsweredAssumed Answered

JSON question in certificate guide

Question asked by ndveitch on May 11, 2018
Latest reply on May 11, 2018 by ThierryGuemboura


Hi there,

 

Im only now getting into JSON and I was going over the FM16 study guide and I saw the one JSON question they ask is,

 

Given this JSON data

$$json = {\”Person\”:[{\”Age\”:42, “First\”:\”John\”,\”Last\”:\”Smith\”}, {\”Age\” :39,\”First\”:\”Jane\”,\”Last\”:\”Jones\”}]} 

What is the result of each of these functions?

  1. JSONFormatElements ( $$json )
  2. JSONListValues ( $$json ; “Person” )
  3. JSONGetElement ( $$json ; “Person[1].Last” )

 

From looking at it, I was able to work out a. and c. because I can see what the format should look like, and I just had to remember that the array starts at 0 and not 1, but b. I was a little unsure of. So I went to the data viewer to see if I could work it out, but the line of code wouldn't execute. It kept saying table missing. I tried to play around with the code but whatever I tried I could not get any result. I even tried some of the JSON parsing FM solutions I have found on the net and none of them could get the result. The Parsing File I found on the Soliant Website kept coming back with 

? * Line 1, Column 2

  Missing '}' or object member name

* Line 1, Column 88

  Extra non-whitespace after JSON value.

 

What am I doing wrong?

Outcomes