If your agent output valid JSON then no such function is needed.
All my special agents use pure JSON output and a “json.loads(section[0][0])” is enough.
A simple parse function for JSON section could look like this.
def parse_redfish(string_table: StringTable) -> RedfishAPIData:
"""parse one line of data to dictionary"""
try:
return json.loads(string_table[0][0])
except (IndexError, json.decoder.JSONDecodeError):
return {}
The RedfishAPIData can be ignored.
For multiline JSON every line need to be a valid JSON structure and the parse function need to respect this.