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",
},
},
},
},
};
npm i json-unflat --save
For TypeScript usage there is a index.d.ts in node_modules folder
import { JsonUnFlat } from "json-unflat";
let json = {
"MY.UNFLATTEN.JSON.FILE.TITLE": "foo",
"MY.UNFLATTEN.JSON.FILE.DESCRIPTION": "bar",
};
let unflatten = JsonUnFlat(json);
$ ./production