JSON5 Tools ########### :category: PHP :date: 2025-07-11 05:46:00 +0300 :tags: json5, docker, config Presenting a couple of JSON5 tools I built. The first one was done a year ago, a docker CLI image to convert JSON5 to JSON: `arokettu/json5-to-json`_. .. _arokettu/json5-to-json: https://hub.docker.com/r/arokettu/json5-to-json .. code-block:: bash $ echo "{ hello: 'world' }" | docker run -i --rm arokettu/json5-to-json {"hello":"world"} A simple tool to convert your configs on the build phase without installing anything into your images. The second one is a builder/serializer that is aimed at creating pretty configs in PHP: `arokettu/json5-builder`_. .. _arokettu/json5-builder: https://packagist.org/packages/arokettu/json5-builder While it can just serialize some data into JSON5, the goal is to create nice configs with comments and custom formatting. .. code-block:: php '<- Look, no quotes!', 'value' => new CommentDecorator( new HexInteger(0xFFF), commentAfter: 'This is a very important value' ), 'notAvailableInJSON' => [NAN, INF], 'end' => 'auto trailing comma ->' ], commentBefore: 'This is my cool JSON5 config!', ); echo Json5Encoder::encode($config); .. code-block:: js // This is my cool JSON5 config! { bareKeys: "<- Look, no quotes!", value: 0xFFF, // This is a very important value notAvailableInJSON: [ NaN, Infinity, ], end: "auto trailing comma ->", }