Hashtag Helpers
Parse JSON
Returns value of a JSON string
This hashtag helper allows you to get the value from any valid JSON string.
The helper will automatically handle markdown JSON strings that start with the JSON delimiter and end with the ending JSON delimiter.
NOTE
If the string provided cannot be converted to a JSON object, the helper will return the string as is.
Uses
- Use to convert returned data from an API into a JSON object.
- Use to extract a value from a JSON string.
- Use to convert a string into a number.
- Use to convert markdown JSON response from a LLM into a JSON object
Usage
Helper name : parse_json
eg.
~~#parse_json#[JSON string]
Examples
Simple JSON String
This shows the use of the Parse JSON Hashtag Helper to convert a JSON string to a JSON object.
Usage Example
Result
Referencing a JSON String
This shows the use of a value inside the data structure that contains the JSON you want to convert.
Consider Data
Usage Example
Result
LLM JSON response in Markdown
This shows how a JSON string inside the markdown delimiters will be handled.
Usage Example
Result