formatJSON
To create a JSON string of a valid JSON object
This function converts a JSON object to a string. This can be useful if you want to check the content of an incoming JSON object or if you want to modify it with other text functions.
formatJSON(JSON)
string
With this script inserted in a button, you can store the response of an API GET request in the field Text to check the response object. Without
formatJSON()
the result would not be very helpful. Please remember to exchange the following API key with your personal API key.
1
let databaseURL := "https://api.ninoxdb.de/v1/teams/" + teamId() + "/databases/" + databaseId() + "/tables/" + tableId(this);
2
let myAPIKey := "Bearer abcd1234-0000-xxxx-zzzz-1a1aa1aaa1a111";
3
let response := http("GET", databaseURL, {
4
Authorization: myAPIKey
5
}, null);
6
'Text' := formatJSON(response)
Result: You'll get a JSON string with data of your current table:
{"result":{"id":"I","name":"Table1","fields":[{"id":"A","name":"Text","type":"string"},{"id":"B","name":"Number","type":"number"},{"id":"D","name":"Text 2","type":"string"}]}}
Last modified 1yr ago