Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have created a job for extract the data from mongodb to sql server. I need to maintain parent child relation from array "dependentQuestionResponse". eg. See attached json image, "dependentQuestionResponse" there are _id 133 is parent and _id 278 is child, so how can we define that relationship.
Please find the below json data.
[{"_id":44444,"userId":1879,"questionResponse":[{"_id":660,"title":"questionTest1","description":"questionTest1","question":"questionTest1","type":"radio","response":{"value":["option_5"]},"dependentQuestionResponse":[]},{"_id":661,"title":"questionTest2","description":"questionTest2","question":"questionTest2","type":"radio","response":{"value":["option_5"]},"dependentQuestionResponse":[]},{"_id":662,"title":"questionTest3","description":"questionTest3","question":"questionTest3","type":"checkbox","response":{"value":["option_1","option_3","option_4"]},"dependentQuestionResponse":[]},{"_id":663,"title":"questionTest4","description":"questionTest4","question":"questionTest4","type":"text","response":{"value":[""]},"dependentQuestionResponse":[]}]},{"_id":55555,"userId":1191,"questionResponse":[{"_id":264,"title":"questionTest5","description":"questionTest5","question":"questionTest5","type":"radio","response":{"value":["option_1"]},"dependentQuestionResponse":[]},{"_id":265,"title":"questionTest6","description":"questionTest6","question":"questionTest6","type":"radio","response":{"value":["option_3"]},"dependentQuestionResponse":[{"_id":133,"title":"questionTest7","question":"questionTest7","type":"radio","response":{"value":["option_11"]},"dependentQuestionResponse":[{"_id":278,"title":"questionTest8","question":"questionTest8","type":"text","response":{"value":["street no 140"]},"dependentQuestionResponse":[]}]},{"_id":154,"title":"questionTest8","question":"questionTest8","type":"dropdown","response":{"value":["option_14"]},"dependentQuestionResponse":[]}]},{"_id":266,"title":"questionTest8","description":"questionTest8","question":"questionTest8","type":"radio","response":{"value":["option_1"]},"dependentQuestionResponse":[]}]}]
Also attached the screenshots of Job and current output.
Please find the attached json data.
Hi
I just take a look at your json data, I see there is no a field to indicate the relationship between them, the parent id might be 133 or 154 if I set the loop xpath to $[*].questionResponse[*].dependentQuestionResponse[*].dependentQuestionResponse[*]
Regards
Shong