AutoTools JSON Write
Write a JSON data structure
Examples
Json Input
If you have some already existing JSON data, you can add to it using this option. All operations will be done on top of this instead of on blank JSON data
Separator
In this action you'll write multiple values in some fields. Use this separator to separate those values. Remember, if you change this separator you need to change it in every field where you write multiple values.
Simple Values
Use this to write simple values at the root of the JSON data. For example, if you set
Json Keys to
name,age and
Json Values to
John,17 you'll end up with a JSON structure like this:
{
"name": "John",
"age": "17"
}
Arrays
Simple Adding
Use this to write simple arrays at the root of the JSON data. For example, if you set Add to Array Key to cars and Json Values to Mercedes,Fiat,Ford you'll end up with a JSON structure like this:
{
"cars": [
"Mercedes",
"Fiat",
"Ford"
]
}
Multiple Array Adding
If you set
- Add to Array Key to cars
- Array Object Keys to brand,model,year
- Array Object Values to Mercedes,Fiat,Ford|GLC,500,Focus|2015,1999,2004
you'll end up with a JSON structure like this:
{
"cars": [
{
"brand": "Mercedes",
"model": "GLC",
"year": "2015"
},
{
"brand": "Fiat",
"model": "500",
"year": "1999"
},
{
"brand": "Ford",
"model": "Focus",
"year": "2004"
}
]
}
As you can see it's very easy to convert multiple Tasker arrays to a complex JSON data structure
Updating
In this action you can update existing JSON values. You have to provide the
Json Input field with some existing data.
For example, if you want to update the existing
cars structure above and update the
year on the
Ford car to
2016 you would set:
- Json Input to the cars JSON data above
- Update Fields to year
- Update Values to 2016
- Filter Field to cars.brand
- Filter Value to Ford
Deleting
In this action you can delete existing JSON values. You have to provide the
Json Input field with some existing data.
For example, if you want to update the existing
cars structure above and delete the
Fiat car you would set:
- Json Input to the cars JSON data above
- Delete Paths to cars.brand
- Delete Values to Fiat
Prettify
If you want to make the JSON structure easier to read enable this option. Be aware that it'll add more white charaters to the text so it'll take up a bit more space.