Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleParse the JSON sample data using json.parse{data=Data}
Code Block
languagelua
local patient = json.parse{data=Data}

JSON objects are parsed into Lua tables as dictionaries with key-value pairs. You can see this clearly in the Annotation Window.

Expand
titleUse an if statement to map a new value for the state "CA" to "California"

Using if statements, we can conditionally map new values when the specified condition is true.

Code Block
languagelua
local state = patient.address.state
if state == "CA" then 
   state = "California"    
end 
trace(state)
Expand
titleImport the Codemap Library

if statements

Expand
titleSerialize the table as a JSON string using json.serialize{data=Data}
Code Block
languagelua
local string = json.serialize{data=patient}
trace(string)

...