I'm also having problems with some non alphanumeric characters when deserializing JSON from web APIs. Many of them have "@" character for hyperlinks, ":" for CURIEs, and "-" characters otherwise in table keys.
Here are examples:
Code: Select all
; works
json$ = "{\"test\": \"alphabets\"}"
t = DeserializeTable(json$)
DebugPrint(t["test"])
; fails
json$ = "{\"te:st\": \"colon\"}"
t = DeserializeTable(json$)
DebugPrint(t["te:st"])
; fails
json$ = "{\"@test\": \"at\"}"
t = DeserializeTable(json$)
DebugPrint(t["@test"])
; fails
json$ = "{\"te-st\": \"hyphen\"}"
t = DeserializeTable(json$)
DebugPrint(t["te-st"])
Basically these should work as table keys in Hollywood, because this is fine:
Code: Select all
; all work
t = {}
t["test"] = "alphabets"
t["te:st"] = "colon"
t["@test"] = "at"
t["te-st"] = "hyphen"
DebugPrint(t["test"], t["te:st"], t["@test"], t["te-st"])
Any work-arounds or solutions? I'm getting spaghetti code if I try to replace those characters with placeholders, because it messes the actual data strings too...