Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Filters JSON object array to find matching entries.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
JSON | 13.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
json | A JSON text or reference. | "[{\"key\": 1}]" | |
Label | The label for the value in the object to compare. | "key" | |
find | A JSON text or reference to find. | 1 | |
byContent | Compare JSON by content, so number can be found via text. Default is 0, so type counts first. |
1 | Optional |
Returns JSON or error.
Try it:
MBS( "JSON.FilterObjectArray"; "[{\"test\":12}, {\"test\":123}]"; "test"; 123 )
Example result:
[
{
"test": 123
}
]
Try with string:
MBS( "JSON.FilterObjectArray";
"[ {\"test\":\"abc\", \"ID\": 1}, {\"test\":\"Hello\", \"ID\": 2} ]";
"test"; "\"Hello\"" )
Example result:
[
{
"test": "Hello",
"ID": 2
}
]
Try same with JSON.Query:
MBS( "JSON.Query";
"[ {\"test\":\"abc\", \"ID\": 1}, {\"test\":\"Hello\", \"ID\": 2} ]";
"$[?(@.test == 'Hello')]" )
Example result:
[
{
"test": "Hello",
"ID": 2
}
]
This function checks for a license.
Created 26th May 2023, last changed 10th January 2024