The flattenjs utility enables JSON documents to be filtered and parsed with line-oriented utilities by printing a flattened representation that is compatible with the PostgreSQL query operators #> and #>>.

flattenjs was initially designed as a companion to pg_tmp.

Installation - BSD, Mac OS, and Linux

make install

Or to specify a specific installation location

PREFIX=$HOME/local make install

Man Page Examples

Print a flattened representation of a JSON structure:

$ flattenjs < my.json

Print the lines for any path that contains the word "author":

$ flattenjs < my.json | awk '/author.+ /'


A release history as well as features in the upcoming release are covered in the NEWS file.


Source is under and ISC-style license. See the LICENSE file for more detailed information on the license used for compatibility libraries.