Skip to content

JSONParser hates the word "clear"? #9

@deldrid1

Description

@deldrid1
#require "JSONParser.class.nut:1.0.0"

local json = @"{
    ""clear"": 157
}"

local tbl = {
    "clear": 157
}

// This works fine
server.log(http.jsondecode(json))
server.log(http.jsondecode(http.jsonencode(tbl)))


// Both of these fail
server.log(JSONParser.parse(json))
server.log(JSONParser.parse(http.jsonencode(tbl)))
2018-09-13 18:51:32 -04:00 | [Status] | Agent started.
2018-09-13 18:51:32 -04:00 | [Agent] | (table : 0x7efb4b3658f0)
2018-09-13 18:51:32 -04:00 | [Agent] | (table : 0x7efb194c9380)
2018-09-13 18:51:32 -04:00 | [Agent] | ERROR: JSON Syntax Error near `: 157 }`
2018-09-13 18:51:32 -04:00 | [Agent] | ERROR:   in parse ...imp#jsonparser.class.nut#1.0.0:286
2018-09-13 18:51:32 -04:00 | [Agent] | ERROR:   from main agent_code:18

Any ideas? I've noticed that it doesn't really seem to matter where in the table clear shows up... (i.e. it can be nested, etc.). Reviewing the code though I don't see any particular reason this would have an issue...

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions