Don't have any material in particular. @SP20 @Anonymous
The key thing to note is that JSON is made up of key value pairs (also known as objects) and arrays.
A key value pair looks like this...
{"Key":"Value"}
An array looks like this...
[1,2,3,4,5]
A key value pair, containing an array as the value looks like this...
{
"Person": [
"Jim",
"John",
"Joseph"
]
}
Values within JSON can have different types i.e. strings and integers (take note of the " " around the string, the integer does not have this):
{
"Name": "John",
"Age": 32
}
JSON objects can be nested within other objects. For example:
{
"Person": [
{
"Name": "Jim",
"Age": 32
},
{
"Name": "John",
"Age": 24
},
{
"Name": "Joseph",
"Age": 16
}
]
}
In order for Power Automate to understand JSON, it needs to be parsed (done by default with a lot of connectors). To parse JSON, you need to define a schema (essentially instructions detailing how the JSON is structured). An example JSON schema for the above code snippet can be seen below:
{
"type": "object",
"properties": {
"Person": {
"type": "array",
"items": {
"type": "object",
"properties": {
"Name": {
"type": "string"
},
"Age": {
"type": "integer"
}
},
"required": [
"Name",
"Age"
]
}
}
}
}
Generally, you do not need to learn how to write JSON schema from scratch, Power Automate has a JSON schema generator you can use in the 'Parse JSON' action by copying in your example JSON. It is useful to understand the general theory so you are able to change required fields or field types whereby the schema generator is not 100 percent accurate. The more complex the problem, the more JSON schema you will be required to write.
In regards to the body vs value debate, the body is the entire JSON response returned from the SharePoint API request (containing a lot of crap you likely don't need). The Value is the array of all the list items returned containing the information you likely need. The body is the entire JSON object, the value is an array within the body object.