json2table-schema

    1.0.2 • Public • Published

    json2table-schema

    CLI tool to generate a table-schema provided a path to some sample JSON.

    The sample JSON should be an array of objects.

    It will loop thru each object, flatten them down into a tabular format, and produce a schema compliant with this spec: https://frictionlessdata.io/docs/table-schema/

    The "name" property will be alphanumeric with underscores -- this is compatible with Google BigQuery's tables, as well as likely every database under the sun.

    In addition to the "name" field, it will also add a "jsonPath" property to each field.

    This jsonPath is compliant with lodash/get for getting data from json blobs of the same shape.

    It does NOT automatically fill in the "type" and "description" fields, but it does produce them as empty placeholders.


    Installation

    npm i -g json2table-schema

    Usage

    json2table-schema /path/to/example.json

    Example

    $ json2table-schema ./example/eg6.json | jq
    {
      "fields": [
        {
          "name""col1",
          "type""string",
          "description""",
          "jsonPath""col1"
        },
    ...

    Keywords

    none

    Install

    npm i json2table-schema

    DownloadsWeekly Downloads

    1

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    11.7 kB

    Total Files

    17

    Last publish

    Collaborators

    • deanrather