in reply to Re^3: Find a Position and Insert Text
in thread Find a Position and Insert Text

In the original data, age1 occurs two times (with potentially two different values), while in your approach, both entries will share the same value. I don't know if that is important for the OP though.

Replies are listed 'Best First'.
Re^5: Find a Position and Insert Text
by Your Mother (Archbishop) on Mar 17, 2016 at 17:28 UTC

    Good eye++. It is the same issue as Perl hashes though. Duplicate Object keys in JS are a mistake and will be clobbered.

    <script type="text/javascript"> var p = { "age1":"one", "age1":"two" }; for ( var key in p ) { if ( p.hasOwnProperty(key) ) { document.write(key + " -> " + p[key] + "<br/>"); } } </script> age1 -> two