Skip to content

Commit

Permalink
Merge pull request #160 from ValikoDorodnov/json_unescaped_unicode
Browse files Browse the repository at this point in the history
Flags for json_encode() in \cebe\openapi\Writer::writeToJson()
  • Loading branch information
cebe committed Apr 20, 2022
2 parents c448862 + e4e00c1 commit 020d72b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ class Writer
/**
* Convert OpenAPI spec object to JSON data.
* @param SpecObjectInterface|OpenApi $object the OpenApi object instance.
* @param int $flags json_encode() flags. Parameter available since version 1.7.0.
* @return string JSON string.
*/
public static function writeToJson(SpecObjectInterface $object): string
public static function writeToJson(SpecObjectInterface $object, int $flags = JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE): string
{
return json_encode($object->getSerializableData(), JSON_PRETTY_PRINT);
return json_encode($object->getSerializableData(), $flags);
}

/**
Expand Down

0 comments on commit 020d72b

Please sign in to comment.