Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Commit f7c9131

Browse files
patricksmmskylef
authored andcommitted
feat(json): add indentation to serialize output
1 parent 85c442f commit f7c9131

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

packages/json-serializer/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# JSON Serializer Changelog
22

3+
## 0.1.3 (2020-08-20)
4+
5+
### Enhancements
6+
7+
- Add indentation to the output.
8+
39
## 0.1.2 (2020-08-19)
410

511
### Enhancements

packages/json-serializer/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ const api = new fury.minim.elements.Object({ name });
1919
const mediaType = 'application/json';
2020
fury.serialize({ api, mediaType }, (error, body) => {
2121
console.log(body);
22-
// { "name": "Doe" }
22+
// {
23+
// "name": "Doe"
24+
// }
2325
});
2426
```

packages/json-serializer/lib/serializeJSON.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function serializeJSON(element) {
3030
const dataStructures = collectElementByIDs(element);
3131
const value = element.valueOf(undefined, dataStructures);
3232

33-
return JSON.stringify(value);
33+
return JSON.stringify(value, null, 2);
3434
}
3535

3636
module.exports = serializeJSON;

packages/json-serializer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@apielements/json-serializer",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"description": "JSON serializer for API Elements",
55
"author": "Apiary.io <[email protected]>",
66
"license": "MIT",

0 commit comments

Comments
 (0)