I am using ChatGPT in Xojo to extract some fields from an Invoice.
I want to parse the json that is returned so that I can fill some text boxes.
Can someone show me some code to parse this?
Assuming the text is in a variable we’ll call json, something like this:
var jsonDict as Dictionary = ParseJSON( json )
var invoiceNumber as string = jsonDict.Value( "invoice_number" )
var totalAmount as double = jsonDict.Value( "total_amount" )
// etc.
Thanks Kem
I was doing something very simular but was getting an error. I figured out that ChatGPT was adding some extra characters to the beginning and end of the json response. I told chatGPT to not add any extra characters to the response and now it works. Thanks