posts – Optimal WP Web App Backend for mobile app development

Question

I’m having a web app built on wordpress, and am needing to build a mobile app with it. The probably most important aspect of this is that I’ll need to transform all of my AJAX request-responses to the usual JSON-format, to be easily compatible with other APIs / Frameworks used to build mobile apps.

Most of this is done with wordpresses’ native REST API, except regarding my custom post types. These all have a standardized structure; sth like:

<div class="post-content-wrapper">
  <p class="post-info-1">First Info</p>
  <p class="post-inof-2">Second Info</p>
</div>

What I’m thus thinking of is the transformation of this post content into JSON, something like:

{
  'info_1':'First Info',
  'info_2':'Second Info'
}

And then render everything on the client-side (e.g. for web using HTML templates and native Js (I want to refrain from frameworks if not absolutely needed), and for respective other solutions of mobile app frameworks).

In theory, both the wp_posts table’s post_content field (which is where wp post contents are stored), as well as the wp_postmeta table’s meta_value field (which is where meta values of wp posts are stored) are of type longtext; meaning they could easily both hold JSON (I’m using MariaDB, so LONGTEXT is treated equally as JSON).

As this does not seem to be a default possibility in WP, I wondered if it could actually be a problem for some reason to store post contents / post meta values in the JSON format.

Could anyone think of a reason why it could be bad practice?

0
DevelJoe 2 months 2022-06-11T04:21:24-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse