Trying to upload a simple example JSON via the developer console doesn’t seem to work, even tho it has been validated via JSON Lint. (Having a more descriptive error message would be really cool if possible)
Tried 5+ json files and nothing has worked so far. Using the default settings.
Example json: example_1.json (65 Bytes)
@Nikola-Milovic Thanks for the forum post. I know we spoke on Gitter and I wanted to follow up here so that we can share the info until there’s a chance to update our docs with it.
To upload storage objects with the Developer Console you need structure the data as a JSON array of storage objects:
[
{
"collection": "somecoll",
"key": "somekey",
"permission_read": 0,
"permission_write": 0,
"value": {
"somefield": "somevalue"
},
"user_id": "00000000-0000-0000-0000-000000000000"
}
]
Now that you have the structure above you won’t be able to upload it to the Developer Console because the "value"
must actually be an escaped JSON object because the API uses GRPC under the hood which doesn’t know about unstructured data (JSON). This is an implementation detail we’ll get rid of in a future release of the server.
In the meantime you can use a tool like jq which can take your JSON file and do the rewrite needed to prepare it for an import:
jq ".[].value |= tostring" storage.json > storage.gen.json
This will generate output which looks like:
[
{
"collection": "somecoll",
"key": "somekey",
"permission_read": 0,
"permission_write": 0,
"value": "{\"somefield\":\"somevalue\"}",
"user_id": "00000000-0000-0000-0000-000000000000"
}
]
Hope this helps.