mabasic/phel-json

Library for converting Phel datastructures to and from JSON.

Fund package maintenance!
Patreon

0.5.0 2022-06-11 18:30 UTC

This package is auto-updated.

Last update: 2024-12-11 23:42:43 UTC


README

Phel library for converting Phel datastructures to and from JSON.

Become a Patron

Overview

This Phel library is a wrapper library around PHP json_encode and json_decode functions.

It converts Phel datastructures and basic types to a format that PHP understands before calling (php/json_encode).

It generates valid Phel datastructures (map, vector) from given JSON strings using (php/json_decode).

Installation

From the command line:

composer require mabasic/phel-json

Usage

This Phel library has two public method:

  • (json/encode value {:depth 512 :flags 0})
  • (json/decode json {:depth 512 :flags 0})
(ns your\namespace
    (:require mabasic\json\json))

(def result (json/encode {:name "Phel"  :type "lisp"}))

# result
# {"name": "Phel", "type": "lisp"}

(println (json/decode result))

# output
# {:name "Phel"  :type "Lisp"}

For developers

composer install
composer test

Sponsors & Backers

I would like to extend my thanks to the following sponsors & backers for funding my open-source journey. If you are interested in becoming a sponsor or backer, please visit the Backers page.

Contributing

Thank you for considering contributing to Phel-json! The contribution guide can be found Here.

Code of Conduct

In order to ensure that the open-source community is welcoming to all, please review and abide by the Code of Conduct.

License

Phel-json is open-source software licensed under the MIT license.