Handle trailing commas
Closed this issue · 2 comments
kakaska commented
Could you please improve the package to handle this case?
<?php
include 'vendor/autoload.php';
// A variable containing a JavaScript object as a string
$jsObjectString = "{ foo: 'bar', }";
// Convert the Javascript object to JSON format
$json = \OviDigital\JsObjectToJson\JsConverter::convertToJson($jsObjectString);
var_dump($json);
The current output is string(14) "{"foo":"bar",}"