How to Import data in a JSON file into Advanced Custom Fields repeater

I have a local JSON file with about 100 “Quiz” objects. Each object looks like this…

[
‘subject’: ‘Quiz Title’,
‘questions’: [‘question1’, ‘question2’, ‘question3’, etc…],
‘choices’: [
[‘q1-answer1’, ‘q1-answer2’, ‘q1-answer3’, ‘q1-answer4’],
[‘q2-answer1’, ‘q2-answer2’, ‘q2-answer3’, ‘q2-answer4’],
[‘q3-answer1’, ‘q3-answer2’, ‘q3-answer3’, ‘q3-answer4’],
etc.
],
‘answers’: [‘q1-answer3’, ‘q2-answer2’, ‘q3-answer4’, ‘q4-answer2’, etc]
]

I have a Custom Post type called quizzes that has custom fields created with Advanced Custom Fields in which I use a repeater for the questions and a nested repeater for the choices associated with that particular question.

Basically I need to take the data in the json file and upload it so that each question item opens a question line and then each choices array (with the same index as the question item) opens up new choices lines within that questions repeater.

I’m probably not explaining it as well as I should but if you can grasp what I’m trying to do can anyone point me in the right direction as to how to do this?

Read more here:: How to Import data in a JSON file into Advanced Custom Fields repeater

Leave a Reply

Your email address will not be published. Required fields are marked *