Wordpress API Consume

Hi all! I'm trying to consume the Wordpress REST-API  and everything works according to plan, except for one thing: Property names in a JSON structure can't contain the character ‘ : ’. However, the wordpress api contains a property named ‘wp:featuredmedia’. Thus, the field is not mapped to the correct attribute. Does anyone know how I can overcome this and correctly map the unsupported property? Thanks in advance!   
2 answers

Mendix 8.10 added support for JSON property names with the : character and a few others. From the release notes:

  • In JSON structures, you can now use the |^, and : characters in property names.


In prior versions (or for other odd characters), there is a general workaround to handle unsupported characters that still uses out-of-the-box functionality. The trick is to separate the JSON mapping process from the REST call. So, instead of applying an import mapping directly in the REST call activity, store the REST response as a string variable. Then, you can use a Change Variable activity with the replace() function to swap the : with a supported character. Then, use the “apply import mapping” activity to convert the JSON to Mendix objects.


The only thing i can come up with is this. Warning: it is highly custom.

You could investigate using https://appstore.home.mendix.com/link/app/997/ as a basis. It contains java code to convert  set of objects into json  and you can do rest calls with this.

You may need to modify the java code to insert the wp: prefixes.

Hope this helps, i’m very interested if anyone has better tips.