GithubHelp home page GithubHelp logo

cgi-fr / jsonline Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 234 KB

JSONLine data container with command line utility.

License: GNU General Public License v3.0

Dockerfile 0.20% Makefile 0.62% Shell 0.60% Go 98.57%
jsonlines ndjson

jsonline's People

Contributors

adrienaury avatar dependabot[bot] avatar youen avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

jsonline's Issues

feat: add wildcard selection for leaf objects

With this input JSON document

{
  "designation": "Acme Inc.",
  "adresseSiègeSocial": {
    "NumeroRue": "123",
    "NomRue": "Main St.",
    "CodePostal": "12345",
    "Ville": "Anytown"
  },
  "employe": [
    {
      "Nom": "Jane",
      "Prenom": "Doe",
      "dateNaissance": "01-01-1970",
      "LieuNaissance": "Anytown",
      "NombreEnfants": 1,
      "enfant": [
        {
          "Prenom": "John",
          "DateNaissance": "01-01-2000",
          "LieuNaissance": "Anytown"
        },
        {
          "Prenom": "Jack",
          "DateNaissance": "01-01-2002",
          "LieuNaissance": "Anytown"
        }
      ]
    }
  ]
}

FindValuesAtPath("employe.enfant") should return

[
  [
    {
      "Prenom": "John",
      "DateNaissance": "01-01-2000",
      "LieuNaissance": "Anytown"
    },
    {
      "Prenom": "Jack",
      "DateNaissance": "01-01-2002",
      "LieuNaissance": "Anytown"
    }
  ]
]

FindValuesAtPath("employe.enfant.*") should return

[
  {
    "Prenom": "John",
    "DateNaissance": "01-01-2000",
    "LieuNaissance": "Anytown"
  },
  {
    "Prenom": "Jack",
    "DateNaissance": "01-01-2002",
    "LieuNaissance": "Anytown"
  }
]

feat: remove fields not declared in template

Problem

we can't use jl command to normalize a json stream with only wanted fields.

$ jl -t '{"name": "string"}' <<EOF
{"name": "Martin", "city": "London"}
EOF
{"name":"Martin","city":"London"}

Proposal

Add --strict flag (-s for short) to filter out not declared fields.

$ jl --strict -t '{"name": "string"}' <<EOF
{"name": "Martin", "city": "London"}
EOF
{"name":"Martin"}

feat : add max size parameter for string and truncate output

Problem

Column definition in database have a max size definition. Trying to insert a bigger value with lino push failed.

Proposal

Define a template with max size parameter that truncate string longer than max size definition.

$ jl -t '{"name": "string(4)"}' <<EOF
{"name": "Martin"}
EOF
{"name":"Mart"}

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.