Home » Web Services » Services_JSON
PHP implementaion of json_encode/decode
This package is unmaintained.
Download latest release 1.0.3 (archived versions might be outdated)
License: BSD
Description
JSON (JavaScript Object Notation, http://json.org) is a lightweight data-interchange format.
It is easy for humans to read and write. It is easy for machines to parse and generate.
It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999.
This feature can also be found in Python. JSON is a text format that is completely language independent
but uses conventions that are familiar to programmers of the C-family of languages, including
C, C++, C#, Java, JavaScript, Perl, TCL, and many others. These properties make JSON an ideal
data-interchange language.
This package provides a simple encoder and decoder for JSON notation. It is intended for use
with client-side Javascript applications that make use of HTTPRequest to perform server
communication functions - data can be encoded into JSON notation for use in a client-side
javascript, or decoded from incoming Javascript requests. JSON format is native to Javascript,
and can be directly eval()'ed with no further parsing overhead.
Maintainers
- Michal Migurski (migurski) — lead, active
- Alan Knowles (alan_k) — lead, active
Dependencies
Required
- PHP (>= 4.3)
- PEAR Installer (>= 1.4.0b1)
Releases
- 1.0.3 (stable, 2011-01-14)
Release notes
License: BSD
Minor feature / bugfix release
#18018 - toJSON() support (classes can now implement toJSON(), which should return
#17921 - long strings cause problems for parser
#17515 - handle mbstring overloading of strlen
------ - cache lookups for mb functions during constructortoJSON notes:
$ser = new Services_JSON( SERVICES_JSON_USE_TO_JSON );class A {
// toJSON should return an associtive array of the properties to serialize
// same standard as JSON.stringify()
function toJSON() {
return array( 'a' => $this->a, 'b'=>$this->b) ;
}
}
echo $sj->encode(new A()); - 1.0.2 (stable, 2010-01-02)
Release notes
License: BSD
Fixed Bug #16908 - When locale was set, and it changed the way numbers are formated, the output for floats was broken
- 1.0.1 (stable, 2009-09-09)
Release notes
License: BSD
Fixed Bug #16585 - Fix correct mime type for encode() - note use encodeUnsafe() to prevent headers being sent.
- 1.0.0 (stable, 2009-05-23)
Release notes
License: BSD
Fixed Bug #16251 - Back out change - Use double quotes as per spec
- 0.9.0 (beta, 2009-03-17)
Release notes
License: BSD
Released into pear with minor changes to original proposal
- encode() - encodes and adds http headers
- encodeUnsafe() - encodes only
- Some UTF8 fixes (better handling of invalid characters)
Bugs
| ID | Status | Type | Version | Date | Summary |
|---|---|---|---|---|---|
| #16251 | Closed | Bug | 0.9.0 | 2009-05-22 | single quotes instead of double quotes -> wrong JSON format |
| #16585 | Closed | Req | 1.0.0 | 2009-09-09 | Wrong HTTP content-type headers returned |
| #16908 | Closed | Bug | trunk | 2009-12-15 | _encode() doesn't work for floats when locale is pt_BR |
| #17138 | Bogus | Req | 1.0.2 | 2010-02-19 | Unexpected behavior |
| #17515 | Closed | Bug | 1.0.2 | 2010-06-23 | Unsafe use of strlen |
| #17921 | Closed | Bug | 1.0.2 | 2010-10-01 | Json decode chokes on long string... |
| #17922 | Bogus | Bug | 1.0.2 | 2010-10-01 | Json decode chokes on long string... |
| #18018 | Feedback | Req | 1.0.2 | 2010-11-01 | implement toJSON() method for objects and no header |
| #18215 | Closed | Bug | 1.0.3 | 2011-01-24 | Error when using decode for longer strings |
| #19710 | Feedback | Req | 1.0.3 | 2012-11-16 | can decode() support the second parameter like json_decode |
| #19920 | Closed | Bug | SVN | 2013-04-29 | PHP function class_name() does not exist - should be get_class() |
| #21169 | Closed | Bug | 1.0.3 | 2017-01-21 | Deprecated Warning |