Giter Site home page Giter Site logo

json.awk's Introduction

JSON.awk

A practical JSON parser written in awk.

Introduction

JSON.awk is a self-contained, single-file program with no external dependencies. It is similar to JSON.sh, a JSON parser written in Bash -- retrieved on 2013-03-13 to form the basis for JSON.awk. Since then, the two projects have taken separate paths, so you will not find all of JSON.sh features in JSON.awk, and viceversa.

Features

  • Single file without external dependencies
  • Can parse one or multiple input files within a single invocation
  • Callback interface (awk) to hook into parser and output events
  • Library of practical callbacks (optional)
  • Capture invalid JSON input for further processing
  • JSON.sh compatible (as of 2013-03-13) default output format
  • Written for POSIX awk; does not require GNU gawk extensions; works with mawk 1.3.4 20150503 and higher (some limitations)
  • Choice of MIT or Apache 2 license

Supported Platforms

All OS platforms for which a POSIX awk implementation is available. Special cases:

Installing

Add files JSON.awk and optionally callbacks.awk to your project and follow the examples.

Usage Examples

For full instructions please read the docs. If you use mawk please read FAQs 6 and 7.

Passing file names as command arguments:

awk -f JSON.awk file1.json [file2.json...]

awk -f JSON.awk - < file.json

cat file.json | awk -f JSON.awk -

Passing file names on stdin:

echo -e "file1.json\nfile2.json" | awk -f JSON.awk

Using callbacks to build a custom application (FAQ 5):

awk -f your-callbacks.awk -f JSON.awk file.json

Applications

  • Opera-bookmarks.awk Extract (Chromium) Opera bookmarks and QuickDial thumbnails. Convert bookmark data to SQLite database and CSV file.

Projects known to use JSON.awk

  • KindleLauncher a.k.a. KUAL, an application launcher for the Kindle e-ink models, uses JSON.awk to parse menu descriptions.

License

This software is available under the following licenses:

  • MIT
  • Apache 2

Credits

  • JSON.sh's source code, retrieved on 2013-03-13, more than inspired version 1.0 of JSON.awk; without JSON.sh this project would not exist.

  • gron for inspiration leading to library module js-dot-path.awk, and for some test files.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.