How to modify data and make in different format of data in javascript? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to modify data and make in different format of data in javascript?

Example - data=[ { "1":{ "101":[{name:'user',ip:[{date:101,ip:12345.12345.12345}], "192":[{name:'user',ip:[{date:192,ip:12345.12345.12345}], "123":[{name:'user',ip:[{date:123,ip:12345.12345.12345}] }, "12":{ "101":[{name:'user',ip:[{date:101,ip:12345.12345.12345}], "192":[{name:'user',ip:[{date:192,ip:12345.12345.12345}], "123":[{name:'user',ip:[{date:123,ip:12345.12345.12345}] } }] I need output data as below Output = [{name:'user',ip:[1234.2334,1234.4665]},{name:'user',ip:[1234.2334,1234.4665]},{name:'user',ip:[1234.2334,1234.4665]}]

8th Apr 2023, 8:05 AM
dinesh kumar
4 Answers
+ 3
There are many possible ways I can imagine to do this transformation. Your question is not specific enough. And make no mistake, I will not write the code for you, but I can help you solve it. Can you explain with your own words, what are the steps to reach this result? It is not apparent what happens with the ID 1, 12, 101, 192 and 123. All the details in the "ip" field look the same, and 12345.12345.12345 is not even valid javascript syntax (it is not a number and not a string, plus it is also not a valid Internet Protocol address).
8th Apr 2023, 9:00 AM
Tibor Santa
Tibor Santa - avatar
0
Please solve anyone if you are able to do this.
8th Apr 2023, 8:06 AM
dinesh kumar
0
This is example data not exactly data
8th Apr 2023, 9:06 AM
dinesh kumar
0
Ip May be same or different
8th Apr 2023, 9:06 AM
dinesh kumar