plainify-loader
Convert JSON to plain object.
Why?
Loader developed for usage with react-intl
which can use only
plain objects as messages object.
But I like structure used in counterpart.js
or Rails I18n
, where locales
represents as nested object, but ids used by library for traversing over
the locales.
Example
in
{
"key": "value",
"nested": {
"other_key": "other_value"
}
}
out
{
"key": "value",
"nested.other_key": "other_value"
}
Warning
The loader provides support only for values represented as strings or objects
with strings values because developed for the particular usage.
Installation
npm install plainify-loader
Usage
import json from "json!plainify!./file.json";
or you can use it with yaml-loader
import json from "json!plainify!yaml!./file.yml";
Contributors
Great thanks to @jumpgh for contributions.