Giter Site home page Giter Site logo

json-unflat's Introduction

json-unflat

Convert flat json like:

let json = {
  "MY.UNFLATTEN.JSON.FILE.TITLE": "foo",
  "MY.UNFLATTEN.JSON.FILE.DESCRIPTION": "bar",
};

to Object like:

let unflatten = {
  MY: {
    UNFLATTEN: {
      JSON: {
        FILE: {
          TITLE: "foo",
          DESCRIPTION: "bar",
        },
      },
    },
  },
};

How to install

npm i json-unflat --save

How to import

For TypeScript usage there is a index.d.ts in node_modules folder

import { JsonUnFlat } from "json-unflat";

How to use

let json = {
  "MY.UNFLATTEN.JSON.FILE.TITLE": "foo",
  "MY.UNFLATTEN.JSON.FILE.DESCRIPTION": "bar",
};

let unflatten = JsonUnFlat(json);

For reBuild

$ ./production

json-unflat's People

Contributors

egorovsa avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

json-unflat's Issues

Add a security policy

Hey there!

I belong to an open source security research community, and a member (@Sampaguitas) has found an issue, but doesn’t know the best way to disclose it.

If not a hassle, might you kindly add a SECURITY.md file with an email, or another contact method? GitHub recommends this best practice to ensure security issues are responsibly disclosed, and it would serve as a simple instruction for security researchers in the future.

Thank you for your consideration, and I look forward to hearing from you!

(cc @huntr-helper)

Problem with unflatting underscore

Hello @egorovsa ,

I've upgraded from version 1.0.1 to 2.0.0 and noticed, that the following content is not unflated correctly:

{
   "VIEWS.PRODUCTS": "foo",
   "VIEWS.PRODUCTS_PER_PAGE": "bar"
}

Actual output:

{
     "VIEWS":
        "PRODUCTS_PER_PAGE": "bar"
}

Expected (same as version 1.0.1):

{
     "VIEWS":
        "PRODUCTS": "foo",
        "PRODUCTS_PER_PAGE": "bar"
}

I suspect this is because the second entry starts the same and continues with an underscore.
If this is intentionally, then it should be mentioned in the changelog.
Otherwise this is a bug.

Thank you for your support.

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.