javascript - Split JSON object with square backet names into sub objects -


We are sorting a form using the serializeObject and then it's in a local storage JSON encoded strings are stored as. When we return this back of the local level, then we have flight [inbound] [0] [ISO] and flight [outbound] [1] [date] etc. This makes it difficult to loop properly afterwards (in JavaScript) because we now have to make the form again with the data stored.

Is there a way to sub-names and decode these key names? Objects? For example:

  flight [outbound] [0] [datetime] = "something"; Flight [outbound] [0] [from] = "something"; Flight [outbound] [0] [to] = "something"; Flight [outbound] [0] [carrier] = "something"; Flight [inbound] [0] [datetime] = "something"; Flight [inbound] [0] [from] = "something"; Flight [inbound] [0] [to] = "something"; Flight [inbound] [0] [carrier] = "something";   

should change to:

  flight = {outbound: {0: {from time to time: "something", from: "something", to: "Some carriers:" something ",}}, inbound: {0: {from time to time:" something else ", from:" something else ", from:" something else ", carrier:" something else ",}}}    

It turns out that the serializeObject plugin we use They are not doing the right thing, for this, switching has given us what we are doing after that.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -