'Among the list of operators such as "?" and "&&" in JSON, what is the meaning of ":"?
Among the list of operators such as "?" and "&&" in JSON, what is the meaning of ":" ? Example code below (see line 5):
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"additionalRowClass":
{
"operator": ":",
"operands":
[
{
"operator": "==",
"operands":
[
{
"operator": "%",
"operands":
[
"@rowIndex",
2
]
},
0
]
},
"sp-css-backgroundColor-noFill",
{
"operator": ":",
"operands":
[
{
"operator": "==",
"operands":
[
{
"operator": "%",
"operands":
[
"@rowIndex",
2
]
},
1
]
},
"sp-css-backgroundColor-BgLightGray30",
""
]
}
]
}
}
Solution 1:[1]
What you are asking is not a JSON question, we need to see the code that parse and uses the values in the JSON to be able to answer what the ":" value is used for.
The JSON itself doesn't have any operators so the code that uses the JSON is using it's values as operators since its a "key":"value" pair (Dictionary)
Example: JSON file:
{
<key>:<value>
}
The code that uses the file parses this file so you can say for example:
var parsed_json = <Parsed json file>
var value = ""
if (parsed_json[<key>] == "Example_value") {
value = parsed_json[<key]
}
In this probably bad example you check if a specific key has the value "Example_value" and set it to that value.
In your case the value is ":" so depending on where it's used in the code that uses this value it can mean anything so we need to see that code to help you with what you are asking
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Timmy |
