0

I have this problem on Wordpress. I have a json file with a structure like this

{ 
   "obj": [ 
      "obj1": {
         "field1": "..",
         "field2": [
            {
                "field": ""
            }
         ] 
      }, 
      "obj2": {
       "field1": "..",
         "field2": [
            {
                "field": ""
            }
         ] 
     }, 
      ... 
   ]
} 

Now I need to create a page for each obj in the json by using Wordpress Rest API. I know I can do it, but the problem is that in each page I need to put a table populated with some field of each obj. I can create a page, but I don't know how to put table in that page.

Someone can help me? Thanks.

3
  • 1
    Is this a one-off job? Does it run from outside WordPress (= you can us the REST API to make pages, or wp-cli) or inside WordPress (you can use the normal internal APIs)
    – Rup
    Mar 31, 2022 at 8:16
  • It is a one-off job. I need to create a page for each json object once. The page created will not change Mar 31, 2022 at 11:05
  • if you can create the page, it means you can populate it with contents... When you create a page using rest apis, one of the arguments you pass is content, described as The content for the object. Your table goes in there.
    – GrafiCode
    Apr 5, 2022 at 22:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.