Skip to content

Commit

Permalink
feat: update export (#19)
Browse files Browse the repository at this point in the history
* refactor: change app name

* refactor: change app name

* refactor: change app name

* refactor: change app name

* feat: update readme and export;
  • Loading branch information
DMBerlin authored Mar 8, 2024
1 parent 9940b65 commit a0087eb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# JSON-PARSER
# JSON-PARSEFY
This project helps with flattening JSON strings who have repeatedly through a stringed process.
It applies a `JSONParse` method on a stringify data and repeat the process through each node, flattening it until it becomes a JSON object.

Expand All @@ -8,11 +8,11 @@ Example:
const before: string = "{\"name\": \"John Doe\",\"age\": \"30\",\"location\": {\"city\": \"Some City\",\"state\": \"Some State\",\"geo\": \"{\\\"lat\\\": \\\"40000\\\",\\\"lng\\\": \\\"40000\\\"}\"},\"rules\": {\"localWork\": \"true\",\"onlineWork\": \"true\",\"applications\": {\"admin\": \"true\",\"time\": \"no-time\"}},\"availability\": \"{\\\"online\\\": \\\"true\\\"}\"}";
```

Use `treeParsing` to do a BFS JSON parse on the string.
Use `Parsefy` to do a BFS JSON parse on the string.

```ts
import { treeParsing } from "json-parser";
const after = treeParsing(before);
import { Parsefy } from "json-parsefy";
const after = Parsefy.this(before);
```

How it should look after parsing:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "json-parser",
"name": "json-parsefy",
"version": "1.0.0",
"description": "Correct any json string that has been through a loop of stringify methods to remove unnecessary escaped strings.",
"main": "dist/index.js",
Expand Down
9 changes: 7 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
export { JSONFlattener } from "@decorators/json-flattener.decorator";
export { treeParsing } from "@utils/json-tree-parsing.utils";
import { treeParsing } from "@utils/json-tree-parsing.utils";

const Parsefy = {
this: treeParsing,
};

export { Parsefy };

0 comments on commit a0087eb

Please sign in to comment.