0.5.1 • Published 2 years ago

json-fragment-parser v0.5.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

JSON Fragment Parser

Primarily used in scenarios such as generating JSON with AI models like ChatGPT, it can parse the content of an incomplete JSON generated by AI, and then be used to render data early on, enhancing user experience.

Supports Node and all browsers.

中文文档

CI

Install

npm install --save json-fragment-parser

Usage

import { jsonParse } from 'json-fragment-parser';
const objData = jsonParse('{ title: "hello world", content: "hello ');
// { title: "hello world", content: "hello" }

const arrData = jsonParse('["apple", "ora');
// ["apple", "ora"]

Demo

https://codesandbox.io/s/json-fragment-parser-demo-3pnksv?file=/src/App.js

0.5.1

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.1.0

2 years ago