Opened 3 years ago

Closed 3 years ago

#18464 closed defect (not_a_bug)

JSON-parser 'jshn' - changed behavior / r43484

Reported by: bittorf@… Owned by: developers
Priority: normal Milestone:
Component: packages Version: Trunk
Keywords: Cc:


since some commit we have a log full of errors in our community mesh. we parse JSON this way:

HTTP_ANSWER="$( wget -O - "$URL" )"
eval $( jshn -r "$HTTP_ANSWER" )

case "$JSON_VAR_status" in

but there is no more "$JSON_VAR_status".
seems it is now called "$J_V_status". really?
this breaks here...

the wget-output looks like this:

root@box:~ wget  -qO -  "$URL"
  "status": 200,
  "message": "updated",
  "result": {
    "number": 277,
    "mac": "f4ec38fd74b4",
    "last_seen": 1417532727164,
    "network": "ffweimar",
    "location": "/ffweimar/knoten/277"

Attachments (0)

Change History (1)

comment:1 Changed 3 years ago by jow

  • Resolution set to not_a_bug
  • Status changed from new to closed

Well, you relied on undefined internals of the parser.
The proper api to use is:

json_load "$HTTP_ANSWER"
json_get_var status status
case "$status" in

This way your programs will not break if internal vars are getting renamed.

Add Comment

Modify Ticket

as closed .
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.