I
I
Ivan2016-12-08 16:23:59
JavaScript
Ivan, 2016-12-08 16:23:59

How to process JSON recursively?

There is JSON received by AJAX'om. Then it is inserted into the right places with the help of a template engine. The problem is this - the site is multilingual and some data comes by keys of the form name_ru , name_en , desc_ru , desc_en ...
Actually, the task before inserting data must first be filtered, receiving data with the keys name , desc ... In a flat form, I sort of managed , but the problem is that json can be multidimensional and there was a gag with recursion ...
https://jsfiddle.net/xk27kq7p/
in principle, children can also have children (oddly enough :)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question