承接 eugene-melbourne/json-encoder-decoder 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

eugene-melbourne/json-encoder-decoder

最新稳定版本:1.0.6

Composer 安装命令:

composer require eugene-melbourne/json-encoder-decoder

包简介

Encodes and Decodes JSON strings

README 文档

README

Encodes and Decodes JSON strings

Installation

$ composer require  eugene-melbourne/json-encoder-decoder

Most importantly it has default parameters pre-set

  • JSON_THROW_ON_ERROR
  • convertEmptyStringToNull
  • ReturnAsAssociative

It can be changed though.

Also, it can ConvertEmptyStringToNull and has unit tests to see it in action.

Example:

// Example 1
$val = (new JsonEncoderDecoder())->json_encode(null)
// $val = null   

// Example 2
$val  = [chr(160),];
$json = (new JsonEncoderDecoder())->json_encode($val);
// throws JsonException

// Example 3
$val  = [chr(160),];
$json = (new JsonEncoderDecoder())
        ->addOption(JSON_INVALID_UTF8_SUBSTITUTE)
        ->json_encode($val);
// $json = '["\ufffd"]';

See more examples in unit tests.

P.S. The char code 160 would be  

统计信息

  • 总下载量: 2.3k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-08-30