Topic: DMD0480

Help File Version: 2.9.4.37

JSON Pretty Print


Because JSON data is often output without line breaks to save space, it can be difficult for humans to read and make sense of it. JSON Pretty Print helps to solve this by formatting the JSON data so that it is easy to read and debug by human beings. If JSON Pretty Print was launched from the instruction-specific tools selection (the wrench icon) the string structure or the Numeric Data Block field will already be filled in, so all that's required is to click the Refresh button to process the Raw JSON String and display the Pretty-printed JSON text.

 

 


Select the data source that contains the raw JSON text:

  • select String Structure if the raw JSON text is in a system-defined or user-defined String.

  • select Numeric Data Block Containing Text if the raw JSON text is stored in a user-created byte buffer. Enter the Start Address and the Number of Bytes in the fields provided. The Number of Bytes parameter can be the length parameter from the JSONPARSE instruction. If so, this dialog will read that location first to determine the number of BYTEs, then read the Numeric Data Block Containing Text based on that read Number of Bytes element and process those BYTEs accordingly.

 

Click Refresh to process the Raw JSON text and display the Pretty-printed JSON text. After hitting the Refresh button, the Status Window (below the Raw JSON String pane) will contain any parsing errors of the Raw JSON String, like a missing end bracket or an invalid character.

 

Enable Show color-coded nesting to have each nested level of text appear in a different background color.

 

Click Copy to Clipboard to place a copy of the pretty-printed text into the Windows clipboard so that it can be pasted into a separate application.

 


See Also:

HTTPCMD - HTTP Request / Response with Server

 

JSONBUILD - Build JSON Record

 

JSONPARSE - Parse JSON Text

 


Related Topics:

Ladder Views -> Popup Instruction-specific Tools