Json files do not have to be an object (table).
They can be just an array, which we don't (and can't) handle atm because we return a table instead of a var
This usecase of JSON is perfectly valid, and Juicy (who I cant seem to @ ) has already ran into this problem grabbing data from speedrun.com
If anyone else is looking for the solution to this in the future, (in script) you can use string concatenation to encapsulate the JSON array in an object and then you can parse it into a table with the normal JSON functions
string jsonArray = "[\"foo\", \"bar\"]" // result from elsewhere, currently cannot be parsed into a table
jsonArray = "{ \"data\": " + jsonArray + "}" // encapsulate the array in an object
// the array data can now be parsed and used
This should be fixed, but should probably be done in a separate PR
Json files do not have to be an object (
table
). They can be just an array, which we don't (and can't) handle atm because we return atable
instead of avar
This usecase of JSON is perfectly valid, and Juicy (who I cant seem to @ ) has already ran into this problem grabbing data from speedrun.com
If anyone else is looking for the solution to this in the future, (in script) you can use string concatenation to encapsulate the JSON array in an object and then you can parse it into a table with the normal JSON functions
This should be fixed, but should probably be done in a separate PR
_Originally posted by @ASpoonPlaysGames in https://github.com/R2Northstar/NorthstarLauncher/pull/404#discussion_r1113702357_