Deserialising JSON Array
Comments
-
Hi,
First thing to ensure is that the JSON is being saved as a Data structure if you want to deserialise it into data thats going to be saved or manipulated.
A quick & effective way to do this is to Create A Data structure which will understand our JSON, we do this by clicking Creat Datatypes/Integration, then selecting XML/JSON, select Create Types From JSON and click Create.
Screenshot : https://www.screencast.com/t/CRQvpfrwv
After we create a window pops ups where we define our structure, here we first paste the JSON String into the Json Structure field which will get converted into our DataStructure and then we give it a name. The NameSpace is the location and should automatically populate.
Screenshot : https://www.screencast.com/t/LBzJEAc6r2Zh
We then Click Create and our structure is now ready for us to start passing Arrays into.
Deserialising Array
First we start by dragging a Json Deserialise (inside the Data -> Json steps folder) step into our Flow and start configuring it. In the Type we must select our newly created JSON Data Structure.
Next thing to consider when deserialising JSON array is to ensure that the is IsOutputArray checkbox is ticked which must be checked when we want to pass in an Array within an Object.
Then we declare our String to Deserialise and name our Outputs accordingly.
Screenshot : https://www.screencast.com/t/bfvG97sGkc
This completes the setup of Deserialising JSON Array inside of an Object.
We can now Debug our flow and provided our setup is correct we should see a result like the following screenshot shows :
Screenshot : https://www.screencast.com/t/PYHS9nCAqq8
As we can see here 3 separate items were correctly returned from our JSON String.
I hope this helps
-
Did this fix the issue? I am having the same issue trying to deserializing a JSON array returned from our vCenter API. Here is the exact ouput from the API call as it appears in the debugger\r\n\r\n{[ul][li][url=https://ms-eagle243.ad.georgiasouthern.edu/decisions/Primary/StudioH/?FolderId=3c81c214-9690-11e9-b81e-0050569334cd&pageName=List&flowId=9bc8a264-9696-11e9-b81e-0050569334cd&action=edit]INPUTS[/url]: {[ul][li]VMwareToken: \"ba0472d534b36aa66aebad623e589869\"[/li][/ul]},[/li][li][url=https://ms-eagle243.ad.georgiasouthern.edu/decisions/Primary/StudioH/?FolderId=3c81c214-9690-11e9-b81e-0050569334cd&pageName=List&flowId=9bc8a264-9696-11e9-b81e-0050569334cd&action=edit]OUTPUTS[/url]: [[li]{[ul][li]path: \"Done\
-
After posting my question a little while ago, I realized what the issue was. The response is formatted as a JSON array within a JSON string (value). So I used the "Get Value From Json By Name" step to extract value and passed that string into the deserializer. Magic!
Howdy, Stranger!
Categories
- 4.1K All Categories
- 61 General
- 11 Training
- 201 Installation / Setup
- 1.1K Flows
- 106 Rules
- 260 Administration
- 212 Portal
- 489 General Q & A
- 693 Forms
- 333 Reports
- 3 Designer Extensions
- 47 Example Flows
- 51 CSS Examples
- 1 Diagram Tile
- 7 Javascript Controls
- 178 Pages
- 5 Process Mining
- New Features
- 178 Datastructures
- 69 Repository
- 219 Integrations
- 28 Multi-Tenant
- 27 SDK
- 76 Modules
- 56 Settings
- 25 Active Directory
- 12 Version 7
- 35 Version 8
- 66 Lunch And Learn Questions