Skip to content

Commit

Permalink
Fixed an alignment problem in the pretty output of json
Browse files Browse the repository at this point in the history
  • Loading branch information
doberkofler committed Mar 11, 2020
1 parent 3b496e9 commit 97c4bef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed


## [0.7.1] - 2020-03-11

### Fixed
- Fixed an alignment problem in the pretty output of json.


## [0.7.0] - 2020-03-09

### Changed
Expand Down
15 changes: 9 additions & 6 deletions json_utils.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -551,37 +551,40 @@ BEGIN

PRAGMA INLINE (add_string, 'YES');
json_utils.add_string(theLobBuf, theStrBuf, aName);
ELSE
PRAGMA INLINE (add_string, 'YES');
json_utils.add_string(theLobBuf, theStrBuf, GAP);
END IF;

-- Add the property value
CASE aNode.typ

WHEN json_utils.NODE_TYPE_NULL THEN
PRAGMA INLINE (add_string, 'YES');
json_utils.add_string(theLobBuf=>theLobBuf, theStrBuf=>theStrBuf, theValue=>GAP || 'null');
json_utils.add_string(theLobBuf=>theLobBuf, theStrBuf=>theStrBuf, theValue=>'null');

WHEN json_utils.NODE_TYPE_STRING THEN
PRAGMA INLINE (escape, 'YES');
json_utils.add_string(theLobBuf=>theLobBuf, theStrBuf=>theStrBuf, theValue=>GAP || '"' || escape(theString=>aNode.str, theAsciiOutput=>outputOptions.ascii_output, theEscapeSolitus=>outputOptions.escape_solitus) || '"');
json_utils.add_string(theLobBuf=>theLobBuf, theStrBuf=>theStrBuf, theValue=>'"' || escape(theString=>aNode.str, theAsciiOutput=>outputOptions.ascii_output, theEscapeSolitus=>outputOptions.escape_solitus) || '"');

WHEN json_utils.NODE_TYPE_LOB THEN
PRAGMA INLINE (add_string, 'YES');
json_utils.add_string(theLobBuf=>theLobBuf, theStrBuf=>theStrBuf, theValue=>GAP || '"');
json_utils.add_string(theLobBuf=>theLobBuf, theStrBuf=>theStrBuf, theValue=>'"');
PRAGMA INLINE (escapeLOB, 'YES');
escapeLOB(theInputLob=>aNode.lob, theLobBuf=>theLobBuf, theStrBuf=>theStrBuf, theAsciiOutput=>outputOptions.ascii_output, theEscapeSolitus=>outputOptions.escape_solitus);
PRAGMA INLINE (add_string, 'YES');
json_utils.add_string(theLobBuf=>theLobBuf, theStrBuf=>theStrBuf, theValue=>'"');

WHEN json_utils.NODE_TYPE_NUMBER THEN
PRAGMA INLINE (number_to_json, 'YES');
json_utils.add_string(theLobBuf=>theLobBuf, theStrBuf=>theStrBuf, theValue=>GAP || number_to_json(aNode.num));
json_utils.add_string(theLobBuf=>theLobBuf, theStrBuf=>theStrBuf, theValue=>number_to_json(aNode.num));

WHEN json_utils.NODE_TYPE_DATE THEN
json_utils.add_string(theLobBuf=>theLobBuf, theStrBuf=>theStrBuf, theValue=>GAP || '"' || TO_CHAR(aNode.dat, 'FXYYYY-MM-DD"T"HH24:MI:SS') || '"');
json_utils.add_string(theLobBuf=>theLobBuf, theStrBuf=>theStrBuf, theValue=>'"' || TO_CHAR(aNode.dat, 'FXYYYY-MM-DD"T"HH24:MI:SS') || '"');

WHEN json_utils.NODE_TYPE_BOOLEAN THEN
PRAGMA INLINE (boolean_to_json, 'YES');
json_utils.add_string(theLobBuf=>theLobBuf, theStrBuf=>theStrBuf, theValue=>GAP || boolean_to_json(aNode.num));
json_utils.add_string(theLobBuf=>theLobBuf, theStrBuf=>theStrBuf, theValue=>boolean_to_json(aNode.num));

WHEN json_utils.NODE_TYPE_OBJECT THEN
json_utils.object_to_clob(theLobBuf=>theLobBuf, theStrBuf=>theStrBuf, theNodes=>theNodes, theNodeID=>theNodes(theNodeID).sub, theIndentation=>theIndentation, theFlushToLOB=>FALSE);
Expand Down

0 comments on commit 97c4bef

Please sign in to comment.