[ardoJSON] Trouble with JSON array value

[ardoJSON] Trouble with JSON array value

  
Forge Component
(22)
Published on 2016-08-30 by Ricardo Silva
22 votes
Published on 2016-08-30 by Ricardo Silva
Hi,
I'm playing around with Google Calendar API and I'm using ardoJSON to parse the output from the API.

The problem I'm facing is this:

At a certain point my JSON may have a key attribute called "recurrence" that is of type array but the value is a string and not a collection of items inside curly brackets.

"recurrence": [
    "RRULE:FREQ=WEEKLY;UNTIL=20130930;BYDAY=MO,TU,WE,TH,FR"
   ]

So now in my espace my structure must have an attribute called "recurrence" of type record list but if I say the record definition is a structure with a text value it will fail.

What can I do to overcome this situation?
So just after publishing I noticed a related discussion (Google Books API integration) and I changed the record definition from a structure with text attribute to text directly and it's working now. :)
In order to make use of record lists which were flattened the receiving records needs to have a single attribute named Value of the type being deserialized.

In this case recurrence will be a record list of a record with a Value attribute of type text. The default "Text" record works fine on this :)
I would like to remind you of the existence of the RestWebServices component which takes care of building the required structures for you, if you give it an example.