-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Milestone
Description
We often face issues when we need to modify JSON strings. Usually, we use $replace for that, but it is FAR from ideal.
What we really need is a new modifier similar to $replace that will work with JSON's specifically.
Now, the question is what syntax should we use that can be understood and can be tested/debugged as easy as a regular expression.
I suggest using jq syntax for that: https://stedolan.github.io/jq/
Here's why:
jqis written in C under a permissive license and we can use it as a library: https://github.com/stedolan/jq/blob/master/COPYINGjqcan be used in conjunction withcurlto test the jq expressions: https://stedolan.github.io/jq/tutorial/jqexpressions can also be tested online: https://jqplay.org/
@sfionov @sxgunchenko any ideas on what syntax of this modifier could be?
@AdguardTeam/filters-maintainers what do you think about this idea?
edit: relevant: AdguardTeam/Scriptlets#183 (comment)
Maybe using jq is not that sane, we'd better find something that has implementations in both JS and C/C++
Reactions are currently unavailable