Limitations and Future Work

File ends with ?

With Issue-138, now a question mark ? in a file name has a special semantics, where it means that it is considered an empty JSON object file if the file is not found by the `jq-front’s file searching mechanism.

For instance,

{
  "key": {
     "$extends": [ "missingFile.json?" ]
  }
}

Now, this produces

{
  "key": {}
}

Instead of giving you an error. And currently there is no way to specify a file whose name really ends with ?. This semantics is only introduced in inheritances of JSON files, any other usages are not considered as of now.

Referencing a JSON path containing .

It is tricky to reference a path containing ..

{
  "key": "eval:string:$(ref '.\"key-2.suffix\"')",
  "key-2.suffix": "Hello, world!"
}

Note that you first need the double quotes for the path component (key-2.suffix). Then, you need the single quotes for the entire path expression ('.\"key-2.suffix\"') to prevent the double quotes going away.

Finally, the input renders into a following JSON content.

{
  "key": "Hello, world!",
  "key-2.suffix": "Hello, world!"
}

The quotings are necessary because the jq-front relies on eval built-in of bash for implementing the eval: syntax.

Make it faster

The largest weakpoint of jq-front is its performance. It takes seconds to process even a relatively simple and small file.

However, trying to make jq-front faster sacrificing the readability of it doesn’t seem to me a good idea, especially in case it is written in a language which is generally considered "hard to read and debug".

Instead, we should think of implement it in another language, which is performance-wise more powerful and optimized, such as Java, C#, or whatsoever.

Design consideration

  • Path in JSON

  • Implementing the 'templating' feature.

Path in JSON

To implement a processor like jq-front requires a notation to specify a certain point in a JSON node as a string.

jq has such as feature out-of-box.

{ "a": { "b": 123, "c": ["HELLO"]
} }

The string HELLO in the array in the example above can be specified by a string .a.c[0].

We need to choose a library that can do this sort of work or implement such a functionality by ourselves.

Implementing the 'templating' feature

In order to implement the 'templating' feature, we need to be able to handle a string like following.

    "eval:object:{"hello":"$(ref .root.greeting[0].english)"}

top