Skip to content

Commit 020d72b

Browse files
authored
Merge pull request #160 from ValikoDorodnov/json_unescaped_unicode
Flags for json_encode() in \cebe\openapi\Writer::writeToJson()
2 parents c448862 + e4e00c1 commit 020d72b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: src/Writer.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ class Writer
2020
/**
2121
* Convert OpenAPI spec object to JSON data.
2222
* @param SpecObjectInterface|OpenApi $object the OpenApi object instance.
23+
* @param int $flags json_encode() flags. Parameter available since version 1.7.0.
2324
* @return string JSON string.
2425
*/
25-
public static function writeToJson(SpecObjectInterface $object): string
26+
public static function writeToJson(SpecObjectInterface $object, int $flags = JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE): string
2627
{
27-
return json_encode($object->getSerializableData(), JSON_PRETTY_PRINT);
28+
return json_encode($object->getSerializableData(), $flags);
2829
}
2930

3031
/**

0 commit comments

Comments
 (0)