Object / Arrays in Meta
Currently, meta for posts, users, terms and comments support scalar values in the registered meta
keys. That's booleans, strings and numbers. For comparison, the Custom Fields meta box only allows
string values.
The response format of meta allows for arrays / objects as values, however these types are currently
not accepted in the PHP API via register_meta. There is a clear path forward to allow developers to register meta keys in the REST API using arrays and objects, however as the underlaying register_meta API doesn't support this either yet, it's my recommendation that this wait until a future release.
Object / Arrays in Settings
Currently, settings support scalar values, this is primarily to keep strict data types when
performing validation / sanitization on values to make them match the Schema. Also, all of the WordPress Admin Settings are scalar values.
The WordPress.com API has only one key that is not a scalar, jetpack_protect_whitelist which
accepts an array of IP Addresses, which has specific sanitizing. There's no support for developers
to add settings, and therefore doesn't need to solve this issue generically.
Like meta, the format in the response would allow objects and arrays, it's instead a limitation of the PHP API via register_setting to support object and arrays. Again, this is a clear path forward to add this without breaking any compatibility, it's my recommendation that this wait until a future release.
Object / Arrays in Meta
Currently, meta for posts, users, terms and comments support scalar values in the registered meta
keys. That's booleans, strings and numbers. For comparison, the Custom Fields meta box only allows
string values.
The response format of meta allows for arrays / objects as values, however these types are currently
not accepted in the PHP API via
register_meta. There is a clear path forward to allow developers to register meta keys in the REST API using arrays and objects, however as the underlayingregister_metaAPI doesn't support this either yet, it's my recommendation that this wait until a future release.Object / Arrays in Settings
Currently, settings support scalar values, this is primarily to keep strict data types when
performing validation / sanitization on values to make them match the Schema. Also, all of the WordPress Admin Settings are scalar values.
The WordPress.com API has only one key that is not a scalar,
jetpack_protect_whitelistwhichaccepts an array of IP Addresses, which has specific sanitizing. There's no support for developers
to add settings, and therefore doesn't need to solve this issue generically.
Like meta, the format in the response would allow objects and arrays, it's instead a limitation of the PHP API via
register_settingto support object and arrays. Again, this is a clear path forward to add this without breaking any compatibility, it's my recommendation that this wait until a future release.