change request: filters should allow 'relaxed JSON'

Bug #1714455 reported by Dirk Zimoch
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
EPICS Base
Status tracked in 7.0
7.0
Fix Released
Wishlist
Andrew Johnson

Bug Description

For the sake of easier typing, shorter channel names, improved readability and consistency, CA filters should allow the same simplified (or 'relaxed') JSON syntax as the 3.16 DB parser already allows, that is skipping the quotes around field names.

For example instead of
caget 'test:channel.{"arr":{"s":2,"i":2,"e":8}}'
allow
caget test:channel.{arr:{s:2,i:2,e:8}}

description: updated
Andrew Johnson (anj)
Changed in epics-base:
importance: Undecided → Wishlist
Revision history for this message
Andrew Johnson (anj) wrote :

The YAJL JSON parser library that we use for channel filters and new link types currently only supports strict JSON. The 3.16 DB file parser (implemented in Lex & Yacc) actually converts relaxed JSON into strict JSON for YAJL to parse, and IIRC this means that when setting a new link type at run-time you also have to use strict JSON syntax.

My 'relaxed JSON' rules are actually very similar to a new standard called JSON-5 (which is not meant to replace the original, its syntax updates come from modifications to JavaScript since the original came out). Unfortunately nobody else had started working on adding JSON-5 support to YAJL, and it looks like the original author of the library has abandoned that project so we probably won't see support for JSON-5 added unless we do it ourselves.

I have made a few changes to our copy of the YAJL parser which I'm hoping will be merged into Base by the EPICS 7 release (see https://code.launchpad.net/~epics-core/epics-base/+git/int64/+merge/325537), but so far all I've done is update our copy to yajl-2.1.0, add support for trailing commas in lists and maps, and pull in all the YAJL parser tests. I would be happy to see someone take on the task of extending the parser to support JSON-5.

Changed in epics-base:
status: New → Confirmed
Revision history for this message
Andrew Johnson (anj) wrote :

The changes to YAJL for this are complete and just need to be pulled into Base.

Changed in epics-base:
assignee: nobody → Andrew Johnson (anj)
status: Confirmed → In Progress
Revision history for this message
Andrew Johnson (anj) wrote :

PR for my json5 branch on GitHub at https://github.com/epics-base/epics-base/pull/86

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.