Skip to content
text
NAME
    json - JSON parsing and query program

SYNOPSIS
    json [options] [cmd] file
    json --stdin [cmd] < file
    json field=value
    json field
    json .

DESCRIPTION
    JSON: A JSON parsing and query program

    json [options] [cmd] [file]

        --blend
        --check
        --compress
        --default value
        --env
        --header
        --json
        --json5
        --noerror
        --profile name
        --quiet
        --stdin
        --remove
        --overwrite

    Commands:
        property=value
        property
        .

    The JSON program is a pragmatic, simple JSON parse and query client.

COMMANDS
    json field=value
    json field
    json .

    The json command has several command forms.

        json [options] [cmd] file

    This form reads the supplied JSON or JSON5 file and performs the specified command and emits the result.

        json --stdin [cmd] < file

    When given the --stdin option, the command reads from stdin instead of a file.

QUERYING PROPERTIES
    You can query a property value using the "field" form.

        json address.zip file.json

    This will query the "address.zip" property from the JSON file and emit the result. You can specify the output format with the --json, --json5, --env, --header, and --blend options. For example, to emit the result as a shell environment variable, use the --env option.

        json --env address.zip file.json

SETTING PROPERTIES
    You can update a property value using the "field=value" form.

        json address.zip=98052 file.json

    The field can be a dotted path.

CONVERTING formats
        json --json5 file.json .

    This will convert the JSON file to JSON5 format and emit the result.

OPTIONS
    --blend
        Blend included files from blend[]

    --check
        Check syntax with no output

    --compress
        Emit without redundant whitespace

    --default value
        Default value to use if query not found

    --env
        Emit results as shell environment variables

    --header
        Emit query results as C header defines

    --json
        Emit output as JSON

    --json5
        Emit output as JSON5

    --noerror
        Ignore file open errors

    --profile name
        Merge properties from the named profile

    --quiet
        Quiet mode with no error messages

    --stdin
        Read from stdin

    --remove
        Remove queried property

    --overwrite
        Overwrite file when converting instead of outputting to stdout

COMMANDS
    property=value
        Set queried property

    property
        Query property which can be a dotted path.

    .
        Convert input to desired format.

REPORTING BUGS
    Report bugs to dev@embedthis.com.

COPYRIGHT
    Copyright (c) Embedthis Software.