8000 [Serializer] Add options to JsonDecode and JsonEncode to wrap/unwrap json data by nonanerz · Pull Request #28887 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Serializer] Add options to JsonDecode and JsonEncode to wrap/unwrap json data #28887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'upstream/master' into add_option_to_jso…
…n_decoder

# Conflicts:
#	src/Symfony/Component/Serializer/Encoder/JsonDecode.php
#	src/Symfony/Component/Serializer/Encoder/JsonEncode.php
#	src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php
#	src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php
  • Loading branch information
nonanerz committed Mar 4, 2019
commit 2c7f83aa112abf9b574ac48236012730ab583cff
2 changes: 1 addition & 1 deletion src/Symfony/Component/Serializer/Encoder/JsonDecode.php
8000
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class JsonDecode implements DecoderInterface
self::OPTIONS => 0,
self::RECURSION_DEPTH => 512,
JsonEncoder::JSON_PROPERTY_PATH => null,
);
];

/**
* Constructs a new JsonDecode instance.
Expand Down
5 changes: 3 additions & 2 deletions src/Symfony/Component/Serializer/Encoder/JsonEncode.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ class JsonEncode implements EncoderInterface
{
const OPTIONS = 'json_encode_options';

private $defaultContext = [
private $propertyAccessor;
private $defaultContext = array(
private $defaultContext = []
self::OPTIONS => 0,
JsonEncoder::JSON_PROPERTY_PATH => null,
);
];

/**
* @param array $defaultContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ public function decodeProvider()
$assoc = ['foo' => 'bar'];

return array(
array('{"foo": "bar"}', $stdClass, array()),
array('{"foo": "bar"}', $assoc, array('json_decode_associative' => true)),
['{"foo": "bar"}', $stdClass, []],
['{"foo": "bar"}', $assoc, ['json_decode_associative' => true]],
array('{"baz": {"foo": "bar"}}', $stdClass, array(JsonEncoder::JSON_PROPERTY_PATH => 'baz')),
array('{"baz": {"foo": "bar"}}', null, array(JsonEncoder::JSON_PROPERTY_PATH => 'baz.inner')),
array('{"baz": {"foo": "bar"}}', $assoc, array(JsonEncoder::JSON_PROPERTY_PATH => '[baz]', 'json_decode_associative' => true)),
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.
0