@a-2-c-2-anpm/nihil-dolorum-ea

1.0.0 • Public • Published

Read Json

Reads and parses a JSON file.

No dependencies.

Supported formats

  • Encoding: ANSI, UTF8, UTF16 LE
  • BOM - supports files with a UTF BOM record

Usage

const {readJson} = require("@a-2-c-2-anpm/nihil-dolorum-ea);

const obj = readJson("path/to/file.json");

Examples

Reading {"foo": 42} from various encodings:

Encoding: ansi        , data: {"foo": 42}            , json: {"foo":42}
Encoding: utf8        , data: {"foo": 42}            , json: {"foo":42}
Encoding: utf8-bom    , data: ???{"foo": 42}         , json: {"foo":42}
Encoding: utf16-le-bom, data: ??{ " f o o " :   4 2 }, json: {"foo":42}

Reading {"hello":"Свят"} from various encodings:

Encoding: utf8        , data: {"hello": "????????"}               , json: {"hello":"Свят"}
Encoding: utf16-le-bom, data: ??{ " h e l l o " :   " !?2?O?B?" } , json: {"hello":"Свят"}

Readme

Keywords

Package Sidebar

Install

npm i @a-2-c-2-anpm/nihil-dolorum-ea

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

16.6 kB

Total Files

8

Last publish

Collaborators

  • tranduc345zz