caraml-dev / protopath

JsonPath implementation for Protobuf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Protopath

Implementation of JsonPath syntax that enable value extraction from protobuf message. In the future it can be used to extract any value from any type. This library use Antlr4 as parser.

Getting Started

Capability Matrix

This protopath only support dot notation, we don't have any plan to support bracket notation Below are the supported expression in this library

Expression Description
$.property Selects the specified property in a parent object.
$.properties[n] Selects the n-th element from an array. Indexes are 0-based.
$.properties[index1, index2...] Selects array elements with the specified indexes, return list
$.properties[start:end] or $.properties[start:] or $.properties[:end] or $.properties[:] Selects array elements from the start index and up to, but not including, end index. If end is omitted, selects all elements from start until the end of the array. Returns a list
$.properties[*] Select all objects in properties the result will be flatenned list
$.properties[@.length-n] Select the length-n th elements from array
$.properties[?(expression)] Filter expression. Select all elements in array that match the specified filter

Below are the supported filter expression

Expression Description
== Equal
!= Not Equal
> Greater than
>= Greater equal than
< Less than
<= Less equal than
|| Logical or
&& Logical and

Currently this library haven't supported regex expression filtering

About

JsonPath implementation for Protobuf


Languages

Language:Go 65.2%Language:Java 33.1%Language:ANTLR 1.6%Language:Makefile 0.1%