Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 1

Please help me decide about designing jmespath-like language

I am currently making a parser for json query and projection. I have decide to borrow most of things from http://jmespath.org/ but I want to extend it to also support math and simple language operation and a little more syntax

 

I am now stuck on decision and wish that you could kindly help me with some suggestion

 

  • I would like to support simple math operation +-*/%
    • Is it enough? should I support pow with ** too?
      • I want to keep ** as wildcard operation on any depth, or would it better to use it as pow?
      • log would surely be function, so maybe pow should also be function?
      • ^ might need in bitwise operation
  • I would like to support bitwise operation &|^
    • But still wonder is it really necessary
    • Especially xor operator ^
      • But if I include this ^ operator, it also support boolean xor in addition to && and ||
    • And in jmespath, they use | as pipe operator and & as late binding operator
      • Is it acceptable to use && and || as bitwise operator?
        • 1 || 2 will equal to 3
  • I would like to support ?? and ?! operator
    • And remove support on && || in the same manner of js, it would use only as boolean or bitwise operator
  • Should I bring back root node $ from jsonpath?
  • I would like to add support to backtracing to parent node with @.. syntax
    • direct parent is @..
    • grandparent is @...
    • nth number of dots - 1 will backtrack to nth parent
      • $.me.obj.. is equal to $.me $.me.obj... is equal to $
    • Is there any better syntax for this ?
      • .@ and ..@ maybe ?
  • I would like to add support to index operation with # symbol
    • When iterating on anything, # can be used in scope of iteration
      • When iterate array, # would be index number 0,1,2,...
      • When iterate object, # would be string key
    • Is it a right symbol for this job? Are there any better syntax?
    • What should I do for deeper iteration to reference shallower index ?
      • # for top level, ## for 2nd level ### for 3rd level ?
      • # for current level, ## for previous level ?
      • # for current level, @..# for previous level ?
      • # for current level, ..# for previous level ? (If for this option I should also use ..@)
      • Any other idea for index?
  • Any other idea overall? Any other things you don't satisfied with jmespath?

 

Currently now I work on basic jmespath functionality, will launch a repo soon. It would be the best if I clear all this decision before publish the repo to github