Skip to content

Commit

Permalink
Fix: Encode JSON with JSON_PRETTY_PRINT flag
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Dec 27, 2022
1 parent bff2903 commit 5a823fa
Show file tree
Hide file tree
Showing 62 changed files with 1,093 additions and 62 deletions.
2 changes: 1 addition & 1 deletion src/Format/JsonEncodeOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ private function __construct(private int $value)

public static function default(): self
{
return new self(0);
return new self(\JSON_PRETTY_PRINT);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
{"foo":{},"bar":{"baz":{"qux":"quux","quuz":"corge"},"grault":{"fred":"plugh","garply":"waldo"}}}
{
"foo": {},
"bar": {
"baz": {
"qux": "quux",
"quuz": "corge"
},
"grault": {
"fred": "plugh",
"garply": "waldo"
}
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
{"foo":{},"bar":{"baz":{"qux":"quux","quuz":"corge"},"grault":{"fred":"plugh","garply":"waldo"}},"thud":"xyzzy"}
{
"foo": {},
"bar": {
"baz": {
"qux": "quux",
"quuz": "corge"
},
"grault": {
"fred": "plugh",
"garply": "waldo"
}
},
"thud": "xyzzy"
}
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
{"bar":{"baz":{"qux":"quux","quuz":"corge"},"grault":{"fred":"plugh","garply":"waldo"}},"foo":{}}
{
"bar": {
"baz": {
"qux": "quux",
"quuz": "corge"
},
"grault": {
"fred": "plugh",
"garply": "waldo"
}
},
"foo": {}
}
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
{"bar":[{"foo":9000,"bar":["foo","bar","baz"]},{"foo":9001}],"foo":"bar"}
{
"bar": [
{
"foo": 9000,
"bar": [
"foo",
"bar",
"baz"
]
},
{
"foo": 9001
}
],
"foo": "bar"
}
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
[{"type":"Website","url":"https:\/\/localheinz.com"},"https:\/\/github.com\/localheinz",{"type":"Twitter","url":"https:\/\/twitter.com\/localheinz"}]
[
{
"type": "Website",
"url": "https:\/\/localheinz.com"
},
"https:\/\/github.com\/localheinz",
{
"type": "Twitter",
"url": "https:\/\/twitter.com\/localheinz"
}
]
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
[{"type":"Website","url":"https:\/\/localheinz.com"},"https:\/\/github.com\/localheinz",{"type":"Twitter","url":"https:\/\/twitter.com\/localheinz"}]
[
{
"type": "Website",
"url": "https:\/\/localheinz.com"
},
"https:\/\/github.com\/localheinz",
{
"type": "Twitter",
"url": "https:\/\/twitter.com\/localheinz"
}
]
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
[{"type":"Website","url":"https:\/\/localheinz.com"},"https:\/\/github.com\/localheinz",{"type":"Twitter","url":"https:\/\/twitter.com\/localheinz"}]
[
{
"type": "Website",
"url": "https:\/\/localheinz.com"
},
"https:\/\/github.com\/localheinz",
{
"type": "Twitter",
"url": "https:\/\/twitter.com\/localheinz"
}
]
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
[{"type":"Website","url":"https:\/\/localheinz.com"},"https:\/\/github.com\/localheinz",{"type":"Twitter","url":"https:\/\/twitter.com\/localheinz"}]
[
{
"type": "Website",
"url": "https:\/\/localheinz.com"
},
"https:\/\/github.com\/localheinz",
{
"type": "Twitter",
"url": "https:\/\/twitter.com\/localheinz"
}
]
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
[{"type":"Website","url":"https:\/\/localheinz.com"},{"type":"GitHub","url":"https:\/\/github.com\/localheinz"},{"type":"Twitter","url":"https:\/\/twitter.com\/localheinz"}]
[
{
"type": "Website",
"url": "https:\/\/localheinz.com"
},
{
"type": "GitHub",
"url": "https:\/\/github.com\/localheinz"
},
{
"type": "Twitter",
"url": "https:\/\/twitter.com\/localheinz"
}
]
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
["foo","bar","baz"]
[
"foo",
"bar",
"baz"
]
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
[9001,false,null,"Andreas M\u00f6ller",{"type":"Website","url":"https:\/\/localheinz.com"}]
[
9001,
false,
null,
"Andreas M\u00f6ller",
{
"type": "Website",
"url": "https:\/\/localheinz.com"
}
]
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
["foo","bar","baz"]
[
"foo",
"bar",
"baz"
]
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
["foo","bar","baz"]
[
"foo",
"bar",
"baz"
]
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
[9001,false,null,"Andreas M\u00f6ller",{"type":"Website","url":"https:\/\/localheinz.com"}]
[
9001,
false,
null,
"Andreas M\u00f6ller",
{
"type": "Website",
"url": "https:\/\/localheinz.com"
}
]
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
[{"baz":9000},{"baz":9001}]
[
{
"baz": 9000
},
{
"baz": 9001
}
]
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
["foo","bar","baz",{"baz":"qux","foo":"bar"}]
[
"foo",
"bar",
"baz",
{
"baz": "qux",
"foo": "bar"
}
]
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
{"name":"Andreas M\u00f6ller","urls":["https:\/\/localheinz.com","https:\/\/github.com\/localheinz","https:\/\/twitter.com\/localheinz"]}
{
"name": "Andreas M\u00f6ller",
"urls": [
"https:\/\/localheinz.com",
"https:\/\/github.com\/localheinz",
"https:\/\/twitter.com\/localheinz"
]
}
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
{"name":"Andreas M\u00f6ller","urls":["https:\/\/localheinz.com","https:\/\/github.com\/localheinz","https:\/\/twitter.com\/localheinz"]}
{
"name": "Andreas M\u00f6ller",
"urls": [
"https:\/\/localheinz.com",
"https:\/\/github.com\/localheinz",
"https:\/\/twitter.com\/localheinz"
]
}
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
{"name":"Andreas M\u00f6ller","urls":[{"type":"Website","url":"https:\/\/localheinz.com"},{"type":"GitHub","url":"https:\/\/github.com\/localheinz"},{"type":"Twitter","url":"https:\/\/twitter.com\/localheinz"}]}
{
"name": "Andreas M\u00f6ller",
"urls": [
{
"type": "Website",
"url": "https:\/\/localheinz.com"
},
{
"type": "GitHub",
"url": "https:\/\/github.com\/localheinz"
},
{
"type": "Twitter",
"url": "https:\/\/twitter.com\/localheinz"
}
]
}
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
{"name":"Andreas M\u00f6ller","urls":[{"type":"Website","url":"https:\/\/localheinz.com"},{"type":"GitHub","url":"https:\/\/github.com\/localheinz"},{"type":"Twitter","url":"https:\/\/twitter.com\/localheinz"}]}
{
"name": "Andreas M\u00f6ller",
"urls": [
{
"type": "Website",
"url": "https:\/\/localheinz.com"
},
{
"type": "GitHub",
"url": "https:\/\/github.com\/localheinz"
},
{
"type": "Twitter",
"url": "https:\/\/twitter.com\/localheinz"
}
]
}
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
{"name":"Andreas M\u00f6ller","url-github":"https:\/\/github.com\/localheinz","url-twitter":"https:\/\/twitter.com\/localheinz","url-website":"https:\/\/localheinz.com"}
{
"name": "Andreas M\u00f6ller",
"url-github": "https:\/\/github.com\/localheinz",
"url-twitter": "https:\/\/twitter.com\/localheinz",
"url-website": "https:\/\/localheinz.com"
}
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
{"bar":[{"baz":9000},{"baz":9001}],"foo":"hello"}
{
"bar": [
{
"baz": 9000
},
{
"baz": 9001
}
],
"foo": "hello"
}
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
{"name":"Andreas M\u00f6ller","urls":[{"type":"Website","url":"https:\/\/localheinz.com"},{"type":"GitHub","url":"https:\/\/github.com\/localheinz"},{"type":"Twitter","url":"https:\/\/twitter.com\/localheinz"}]}
{
"name": "Andreas M\u00f6ller",
"urls": [
{
"type": "Website",
"url": "https:\/\/localheinz.com"
},
{
"type": "GitHub",
"url": "https:\/\/github.com\/localheinz"
},
{
"type": "Twitter",
"url": "https:\/\/twitter.com\/localheinz"
}
]
}
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
{"name":"Andreas M\u00f6ller","url-github":"https:\/\/github.com\/localheinz","url-twitter":"https:\/\/twitter.com\/localheinz","url-website":"https:\/\/localheinz.com"}
{
"name": "Andreas M\u00f6ller",
"url-github": "https:\/\/github.com\/localheinz",
"url-twitter": "https:\/\/twitter.com\/localheinz",
"url-website": "https:\/\/localheinz.com"
}
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
{"bar":[{"baz":9000},{"baz":9001}],"foo":"hello"}
{
"bar": [
{
"baz": 9000
},
{
"baz": 9001
}
],
"foo": "hello"
}
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
{"bar":[{"bar":["foo","bar","baz"],"foo":9000},{"foo":9001}],"foo":"bar"}
{
"bar": [
{
"bar": [
"foo",
"bar",
"baz"
],
"foo": 9000
},
{
"foo": 9001
}
],
"foo": "bar"
}
Loading

0 comments on commit 5a823fa

Please sign in to comment.