Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

json-future

kikobeats41.3kMIT2.2.21

Unbelievable and Modern JSON interface.

ES6, ES7, JSON, async, circular, future, interface, load, parse, save, stable, stringify, write

readme

JSON Future

json-future

Last version Build Status NPM Status

Modern JSON interface. propositions for ECMAScript 7.

Why

  • High level methods for manipulate JSON files.
  • Backward compatibility with JSON Object in Node/Browser.
  • Async support (callback/promise) based on ECMAScript proposal.

JSON Future is based into a set of cool libraries to handle JSON, but some of this libraries uses promises or callback style. This library adds an extra layer to call these libraries uniformly.

Install

npm install json-future --save

Usage

const jsonFuture = require('json-future')

Don't be afraid to replace for the default JSON object. The library is specially designed for be compatible and don't break your code:

JSON = require('json-future')

Also you can do this action using the register helper:

require('json-future/register')

API

In async methods, if you don't provide a callback for node style, then the method return a Promise.

.stringify(input, [replacer], [space])

.stringifyAsync(input, [replacer], [space], [cb])

Creates the string version of the input.

.parse(input, [reviver], [filename])

.parseAsync(input, [reviver], [filename], [cb])

Creates the object version of the input.

.load(filepath)

.loadAsync(filepath, [cb])

Returns the parsed JSON.

.save(filepath, data, [options])

.saveAsync(filepath, data, [options], [cb])

Stringify and write JSON to a file atomically.

options

indent

Type: string, number Default: \t

Indentation as a string or number of spaces. Pass in null for no formatting.

sortKeys

Type: boolean, function Default: false

Sort the keys recursively. Optionally pass in a compare function.

replacer

Type: function

Passed into JSON.stringify.

mode

Type: number Default 438 (0666 in octal)

Mode used when writing the file.

License

MIT © Kiko Beats

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

2.2.21 (2023-10-24)

2.2.20 (2023-09-05)

2.2.19 (2023-09-05)

2.2.18 (2022-05-17)

2.2.17 (2022-04-11)

2.2.16 (2022-04-01)

2.2.15 (2022-03-17)

2.2.14 (2021-09-07)

2.2.13 (2021-01-19)

2.2.12 (2020-08-24)

2.2.11 (2020-04-17)

2.2.10 (2020-02-24)

2.2.9 (2020-02-10)

2.2.8 (2020-01-20)

2.2.7 (2019-07-11)

Build System

  • use fast-safe-stringify instead of json-stringify-safe (123fd4a)

2.2.6 (2019-07-02)

Bug Fixes

  • package: update parse-json to version 5.0.0 (079dcd9)

2.2.5 (2019-06-23)

Build System

2.2.4 (2019-06-23)

Bug Fixes

  • package: update async to version 3.1.0 (e4fe67c)

2.2.3 (2019-06-19)

Build System

2.2.2 (2019-06-12)

Bug Fixes

  • package: update load-json-file to version 6.1.0 (4546e3f)

2.2.1 (2019-05-27)

2.2.0 (2019-05-27)

Bug Fixes

  • package: update async to version 3.0.1 (f0975ef)

Build System

2.2.0 (2019-05-27)

  • build: update release message (78facef)
  • fix(package): update async to version 3.0.1 (f0975ef)

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

2.1.10 (2019-05-25)

Bug Fixes

  • package: update write-json-file to version 4.1.0 (d845721)

2.1.9 (2019-05-21)

Bug Fixes

  • package: update write-json-file to version 4.0.0 (61f2dac)

2.1.8 (2019-05-20)

Build System

  • change git-authors-cli position (52f496c)

2.1.7 (2019-04-27)

Bug Fixes

  • package: update load-json-file to version 6.0.0 (605106d)

2.1.6 (2019-04-18)

2.1.5 (2019-04-06)

Bug Fixes

  • package: update load-json-file to version 5.3.0 (3388654)
  • package: update write-json-file to version 3.2.0 (1a0c1e5)

2.1.4 (2019-02-12)

Bug Fixes

  • package: update load-json-file to version 5.1.0 (6845f01)
  • package: update load-json-file to version 5.2.0 (100c8c0)
  • package: update write-json-file to version 3.1.0 (08918b8)

2.1.3 (2018-08-28)

Bug Fixes

  • package: update async to version 2.6.0 (7c91d50)
  • package: update load-json-file to version 3.0.0 (11ae47c)
  • package: update load-json-file to version 4.0.0 (0009698)
  • package: update load-json-file to version 5.0.0 (0784a5e)
  • package: update parse-json to version 3.0.0 (f8eccf7)
  • package: update parse-json to version 4.0.0 (42f4eaf)
  • package: update write-json-file to version 2.3.0 (62740b7)
  • package: update write-json-file to version 3.0.0 (fee0e51)

2.1.2 (2017-07-19)

2.1.1 (2017-07-18)

2.1.0 (2017-04-16)

2.0.1 (2016-07-18)

2.0.0 (2016-06-19)

1.1.5 (2016-01-29)

2.1.3 (2018-08-28)

  • fix(package): update async to version 2.6.0 (7c91d50)
  • fix(package): update load-json-file to version 3.0.0 (11ae47c)
  • fix(package): update load-json-file to version 4.0.0 (0009698)
  • fix(package): update load-json-file to version 5.0.0 (0784a5e)
  • fix(package): update parse-json to version 3.0.0 (f8eccf7)
  • fix(package): update parse-json to version 4.0.0 (42f4eaf)
  • fix(package): update write-json-file to version 2.3.0 (62740b7)
  • fix(package): update write-json-file to version 3.0.0 (fee0e51)
  • Update package.json (73a7049)
  • Update README.md (c8fa6af)
  • docs(readme): add Greenkeeper badge (9937a6e)

2.1.2 (2017-07-19)

2.1.1 (2017-07-18)

  • Update compositor.json (9ed5947)
  • Update README.md (8d53cd6)
  • docs(readme): add Greenkeeper badge (18107e9)
  • chore(package): update dependencies (def90ac)

2.1.0 (2017-04-16)

2.0.1 (2016-07-18)

2.0.0 (2016-06-19)

1.1.6 (2016-06-19)

1.1.5 (2016-01-29)

1.1.4 (2016-01-29)

1.1.3 (2016-01-28)

1.1.2 (2015-11-20)

1.1.1 (2015-10-27)

1.1.0 (2015-10-25)

1.0.3 (2015-10-24)

  • 1.0.3 releases (7efa9db)
  • parse coffee globally for generate browser version (c66c93f)
  • unified async and sync error codes (525b461)

1.0.2 (2015-10-20)

1.0.1 (2015-10-20)

1.0.0 (2015-10-16)