joeattardi/json-colorizer

Converts null fields in to fields of type Boolean & comma is getting trimmed.

arnkumar243 opened this issue · 1 comments

If the Input Json String has some null fields. Then those null fields are getting converted into boolean fields & comma are getting trimmed which makes it invalid JSON.

Please check the below code.
JSON path to check -> integration -> serviceData -> productDefinitions -> IS -> landscapeRegistry -> type

const colorize = require('json-colorizer');

var text = '{"integration": {"message": {"code": 0,"description": "Success"},"serviceData": {"dateCreated": 1556518628526,"createdID": "163df9fc4f1b4946a3e1ac378b45a20b","dateModified": 1556589601769,"modifiedID": "3","description": "sample solution","solutionType": 2,"active": false,"dateActivated": 1556518628526,"productDefinitions": {"IS": [{"name": "IS","version": "10.4","replicaCount": 1,"statefulCluster": false,"productType": "IS","dependencies": ["UM", "DB"],"labels": {"app": "IS","stagename": "Development","product": "is","solution": "Solution3","stage": "stage00","subDomain": "setup","tenantid": "1737250844"},"image": {"tag": "10.4.19.04"},"resources": {"limits": {"cpu": "1","memory": "2"}},"env": {"packages": ["packages.WmCloudStreams.enabled=true", "packages.WmJDBCAdapter.enabled=true"]},"extraParameters": {"cordinates": {"row": 5,"column": 3}},"landscapeRegistry": {"name": "IS","solutionName": "Solution3","stage": "stage00","type": null,"registryRoot": ".","registryNamespacesRoot": "."},"higherVersions": []}],"UNIVERSALMESSAGING": [{"name": "UM","version": "10.4","replicaCount": 1,"statefulCluster": false,"productType": "UNIVERSALMESSAGING","labels": {"app": "UM","stagename": "Development","product": "um","solution": "Solution3","stage": "stage00","subDomain": "setup","tenantid": "1737250844"},"image": {"tag": "10.4.19.04"},"resources": {"limits": {"cpu": "1","memory": "2"}},"env": {"packages": []},"extraParameters": {"cordinates": {"row": 5,"column": 11}},"landscapeRegistry": {"name": "UM","solutionName": "Solution3","stage": "stage00","type": null,"registryRoot": ".","registryNamespacesRoot": "."},"higherVersions": []}]},"stage": "stage00","solutionName": "Solution3"}}}';

console.log(colorize(text));

Thanks for finding this issue! It has been fixed in version 2.1.3 of the package.