[wp-trac] [WordPress Trac] #64926: REST API: GET requests fail object/array schema validation when params are JSON-serialized strings

WordPress Trac noreply at wordpress.org
Wed Mar 25 11:11:42 UTC 2026


#64926: REST API: GET requests fail object/array schema validation when params are
JSON-serialized strings
-------------------------------------+-------------------------------------
 Reporter:  dsmy                     |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  REST API                 |     Version:  trunk
 Severity:  normal                   |  Resolution:
 Keywords:  needs-patch reporter-    |     Focuses:  javascript, rest-api,
  feedback                           |  php-compatibility
-------------------------------------+-------------------------------------

Comment (by zieladam):

 URLSearchParams does seem to support that notation:

 {{{
 const p = new URLSearchParams();
 p.set('user[name]', 'Bob');
 p.set('user[pet]', 'cat');
 console.log(p+'');

 // user%5Bname%5D=Bob&user%5Bpet%5D=cat
 }}}

 When I request `/dump.php?user%5Bname%5D=Bob&user%5Bpet%5D=cat` and
 `var_dump($_GET)` in there, I get the expected result:

 {{{
 array(1) { ["user"]=> array(2) { ["name"]=> string(3) "Bob" ["pet"]=>
 string(3) "cat" } }
 }}}

 Does that help?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64926#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list