I do an Airtable api call to create a record in our Airtable order table. The Airtable api result for creating the order looks like this :
{
"id":"recj9wqdjnNzN3aiu",
"fields": {
"Branch":["rec5S0H7R87QtZ7qJ"],
"Order no.":129,
"Order line items":["recePdIxYgfYlKbaR"],
"Name":"Order #129",
"OrderPrice (excl VAT)":204.07,
"RID":"recj9wqdjnNzN3aiu",
"Product":["rec4j9TqDy8yJXFYg"]
},
"createdTime":"2022-03-03T13:20:22.000Z"
}
From this result I need the Order no. To get the Name I can do :
<cfset filecontent = deserializeJSON(resultUpdAir.filecontent)>
<cfset orderid = filecontent.records[1].fields.name>
But how would I get the Order no. field since there is a space in it?
CodePudding user response:
For situations like these the best way is to circumvent dot.notation and try bracket["notation"] like this:
<cfset orderid = filecontent.records[1]["fields"]["order no."]>