How to programatically add JSON?
Sunday, 16 February 2020 · 1 message
T
thufir16 Feb 2020 19:40 #
I know I've gone around on this before, but looking to import data directly from Java. I've set the parser to "json", am only adding JSONObject string data, and not JSONArray, but am getting "resource not found":
https://stackoverflow.com/questions/60250724/
What does it mean "resource not found"? The data is certainly valid, because the following will import JSON the fine, in fact it even imports the array:
let $database := "blgdfmbljm"
for $name in file:list('.', false(), '*.json')
let $file := file:read-text($name)
let $json := json:parse($file)
return db:add($database, $json, $name)dummy data:
[{"0":"","1":"z10","2":"y9","3":"x7","4":"atrib6","name":"alice"},{"0":"home5","1":"cell4","name":"sue"},{"0":"phone3","1":"phone2","2":"phone1","name":"joe"},{"name":"people"}]So, I guess a two-fold question: how to import a JSONArray with Java, and how to even know what resource isn't found. Doesn't seem likely to be the JSONObject as I've inspected it just prior to invoking Add.
thanks,
Thufir
Written for BaseX 9.3. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery