https://try.jsonata.org/dxPC5s-zM
calling outside object property or parent
Jsonata Date to milliseconds convertion
https://try.jsonata.org/r0q7GnSOh
retreiving data with a name that contains spaces or special charecters with Jsonata
How to group the JSON object by a key using JSONata
I want to use JSONata to do the grouping of json objects in an array based on a key within the JSON object.
For example, I want to group the cars based on their names for the JSON example given below.
[
{
"car" : "audi",
"color" : "blue",
"reg" : 133434
},
{
"car" : "benz",
"color" : "red",
"reg" : 134444
},
{
"car" : "audi",
"color" : "red",
"reg" : 134884
}
]
Expected output
{
"audi" : [
{
"car" : "audi",
"color" : "blue",
"reg" : 133434
},
{
"car" : "audi",
"color" : "red",
"reg" : 134884
}
],
"benz" : [
{
"car" : "benz",
"color" : "red",
"reg" : 134444
}
]
}
$${car: [$.{"car": car, "color": color, "reg": reg}]}
Avg KPI: To get average of array object property
{"payload":[
Jsonata execution through library
https://stackoverflow.com/questions/67056785/why-does-map-not-output-an-array-in-case-the-input-array-is-one-in-length
var json = { "projectIds": [ 1 ] }
var result = jsonata('projectIds[].{"projectId": $}').evaluate(json);
console.log(JSON.stringify(result))<script src="https://cdn.jsdelivr.net/npm/jsonata/jsonata.min.js"></script>
Extract fields by partial name( property value data extraction by calling short name)
I have a json with attribute names that start with some prefixes I need to ignore, and end with the actual field name:
{
"context": {
"values": {
"group1:0:foo": "08119037",
"group1:0:checkbox": [
"2",
"3"
]
}
}
}
I can extract the exact field group1:0:foo, but not "the field that ends with :foo":
{
"foo": context.values.`group1:0:foo`
}https://try.jsonata.org/9vruWw6HR
Use the Transform operator to remove one or more key/value pairs from an Object?
Given this source...
{
"Price": 34.45,
"Product Name": "Bowler Hat",
"ProductID": 858383,
"Quantity": 2,
"SKU": "0406654608"
}
I would like to reduce it to...
{
"Product Name": "Bowler Hat",
"ProductID": 858383,
"SKU": "0406654608"
}https://try.jsonata.org/qUwOtT-pt
Use JSONata to alpha sort keys in a JSON object
Unsorted:
{"B":2,"A":1,"C":3}
Sorted:
{"A":1,"B":2,"C":3}https://try.jsonata.org/RbJqQxO0i
replace $sortObjectAlphabetically($)
How to substitute . with _ in key names? (replacing common propertynames )
https://try.jsonata.org/uZgm69Bfy
https://try.jsonata.org/WsfsFGhjE
differnec between 2 menthods

How to convert an array of string to an array of objects using jsonata?
https://try.jsonata.org/Q5Tt46GBT
https://try.jsonata.org/0L_oYffzT
}projectIds[].{"projectId": $}calling outside object property or parent
https://try.jsonata.org/dxPC5s-zM { "list1" : [ { "b" : 1 , "list2" : [ { ...
-
I want to use JSONata to do the grouping of json objects in an array based on a key within the JSON object. For example, I want to gro...
-
Given this source... { "Price": 34.45, "Product Name": "Bowler Hat", "ProductID": 858383, ...
-
https://try.jsonata.org/uZgm69Bfy https://try.jsonata.org/WsfsFGhjE https://try.jsonata.org/r2GrHYYou differnec between 2 menthods ( $d...











