[wp-trac] [WordPress Trac] #33982: WP REST API Stage One: Infrastructure
WordPress Trac
noreply at wordpress.org
Wed Oct 7 10:54:07 UTC 2015
#33982: WP REST API Stage One: Infrastructure
----------------------------+--------------------------
Reporter: rachelbaker | Owner: rachelbaker
Type: task (blessed) | Status: assigned
Priority: normal | Milestone: 4.4
Component: REST API | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
----------------------------+--------------------------
Comment (by rmccue):
Replying to [comment:21 pento]:
> For [attachment:33982-jsonserialize.diff]:
>
> * What's `WP_JSON_SERIALIZE_COMPATIBLE` for? Do we need to be adding
another constant?
> * What's the difference between this and normal `json_encode()`
behaviour?
The JsonSerializable interface (added in r34845) has two parts: first,
your object implements JsonSerializable; second, `json_encode` calls
`$obj->jsonSerialize()` on the object before encoding. We added the
interface for compatibility, but we haven't added the other side yet. This
handles it inside `wp_json_encode`, which ties it together nicely.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33982#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list