{"id":17088286,"date":"2023-09-29T12:27:52","date_gmt":"2023-09-29T12:27:52","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/expected-format-array-collection\/"},"modified":"2023-09-29T12:27:52","modified_gmt":"2023-09-29T12:27:52","slug":"expected-format-array-collection","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/expected-format-array-collection\/","title":{"rendered":"Expected format array\/collection"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hello,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I would like to update the metadata (custom field) of a user.<br \/>I want to map my result like that (with an array or a collection) :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"RDV\": {\n    \"RDV_{{4.id}}\": {\n      \"Date_rdv\": \"{{4.date}}\",\n      \"heure_debut\": \"{{4.time}}\",\n      \"heure_fin\": \"{{4.endTime}}\",\n      \"prestation\": \"{{4.type}},\n      \"options\": \"{{4.addonIDs}}\",\n      \"prix_prestation\": \"{{4.price}}\"\n    }\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Can you give me the expected format? Because when I try with this format I get an error: <strong>Array of objects expected in parameter &#8216;meta&#8217;.<\/strong><br \/><br \/>I make some test but always this error.<br \/><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For your information, I can have several &#8220;RDV&#8221;.<br \/>All RDV must be in {\u2026}, but each RDV own information must be in its own collection.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The end result would be, for example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"RDV\": {\n    \"RDV_{{4.id}}\": {\n      \"Date_rdv\": \"{{4.date}}\",\n      \"heure_debut\": \"{{4.time}}\",\n      \"heure_fin\": \"{{4.endTime}}\",\n      \"prestation\": \"{{4.type}},\n      \"options\": \"{{4.addonIDs}}\",\n      \"prix_prestation\": \"{{4.price}}\"\n    },\n    \"RDV_{{4.id}}\": {\n      \"Date_rdv\": \"{{4.date}}\",\n      \"heure_debut\": \"{{4.time}}\",\n      \"heure_fin\": \"{{4.endTime}}\",\n      \"prestation\": \"{{4.type}},\n      \"options\": \"{{4.addonIDs}}\",\n      \"prix_prestation\": \"{{4.price}}\"\n    }\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you !<br \/><\/p>\n","protected":false},"template":"","class_list":["post-17088286","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17088286","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17088286\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=17088286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}