Skip to content

PHP library to convert a JavaScript object string to JSON format

License

Notifications You must be signed in to change notification settings

ovidigital/js-object-to-json

Repository files navigation

ovidigital/js-object-to-json

PHP library to convert a JavaScript object string to JSON formatted string

Latest Version Build Status codecov

Installation

composer require ovidigital/js-object-to-json

Usage

// 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);

// Alternatively convert the JavaScript object to a PHP array
$phpArray = \OviDigital\JsObjectToJson\JsConverter::convertToArray($jsObjectString);

Contributing

Feel free to submit a pull request or create an issue.

License

This project is licensed under the terms of the MIT license.

Check the LICENSE.md file for license rights and limitations.

About

PHP library to convert a JavaScript object string to JSON format

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages