I'm using Scala & Argonaut, trying to parse the following JSON:
[
{
"name": "apple",
"type": "fruit",
"size": 3
},
{
"name": "jam",
"type": "condiment",
"size": 5
},
{
"name": "beef",
"type": "meat",
"size": 1
}
]
And struggling to work out how to iterate and extract the values into a List[MyType]
where MyType
will have name, type and size properties.
I will post more specific code soon (i have tried many things), but basically I'm looking to understand how the cursor works, and how to iterate through arrays etc. I have tried using \\
(downArray) to move to the head of the array, then :->-
to iterate through the array, then --\
(downField) is not available (at least IntelliJ doesn't think so).
So the question is how do i:
- navigate to the array
- iterate through the array (and know when I'm done)
- extract string, integer etc. values for each field -
jdecode[String]
?as[String]
?