MetaTag with JSON API won't serialize I'm attempting to get MetaTag info for a decoupled site but the JSON API is not converting the object to JSON correctly. I'm seeing other fields show up fine - the issue is isolated to the MetaTags.

The output appears like this:

field_meta_tags: "a:2:{s:5:"title";s:10:"Test Title";s:11:"description";s:21:"Test Body Description";}",


From what I can tell, s:5 represents an string of 5 characters ("title"), s10 represents 10 characters ("Test Title"), etc etc. Has anyone seen this before?

Drupal 8
Metatag version: '8.x-1.5'
JSON API version: '8.x-1.16'
In fact, the metatag field IS serialized. As stated by Monkeybrain, the result you get as field value is a serialized PHP array.

This is due to the nature of the metatag field, which internally stores its value as a string (serialized PHP array). By using the JSON API module alone, you'll get this value only.

If you need the serialized PHP array to be an unserialized JSON object, you will have to do some custom programming.

Either implement an own REST API endpoint, or - probably easier to do - use the JSON API extras module. It introduces an additional resource field enhancer plugin type to process the values of JSON API entity fields. So you can create an own custom module providing a ResourceFieldEnhancer plugin for the metatags field, which could do your desired unserialization.

Bear in mind, that the value saved within the metatag field(s) does not contain entity defaults. If these are required, you should also use the Metatag module's metatag.manager service to additionally fetch this information.