/json-unflat

Primary LanguageTypeScriptOtherNOASSERTION

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