Last post Feb 25, 2015 12:07 PM by sophia_asp
Feb 17, 2015 12:45 PM|sophia_asp|LINK
I am not sure I am at right place to post this question.
I am in need to represent JSON data as Tree.
I know that JSON data can be converted into Tree by JS libraries, but my main issue is to represent data in two tables as Parent-Child JSON.
My scenario is that, I have two tables say Questions and QuestionAnswers.
1 question can have multiple answers and each answer may be linked to another Question or show No next Question text.
So two tables with data are
Id (primary key) Question
1 Question 1
2 Question 2
3 Question 3
Id (primary key) QuestionId Answer NextQuestionId NoNextQuestion
1 1 Ans 1 0 There is no next question
2 1 Ans 2 2
3 1 Ans 3 3
4 2 Ans 4 3
I wanna show tree view as
-- Ans 1
--- Next Question Name (if any)
--- its answers
-- Ans 2
-- Next Question Name (if any) or No Next Question Text
Please tell me how I can convert my 2 table data to JSON BY either data access approach to match JSON like here
Please help me in this, I will really be thankful to you.
Feb 18, 2015 11:44 AM|Kevin Shen - MSFT|LINK
Then ,I suggest that you could refer to the similar issue in the link below:
Best Regards ,
Feb 25, 2015 12:07 PM|sophia_asp|LINK
I was quite busy in finding solution and making the thing work.
I just needed to create link between questions and assign to Tree plugin and everything worked then.