I'm not overly knowledgeable in JavaScript, but here's the rundown on what I'm trying to do.
I have a JSON object that is prepared by an external source. I'm using that Object as-is to string on to another JSON object that I have prepared, but the problem is that each of the keys need to have a namespace abbreviation in front of them.
So this is what I have:
obj1 = {
  "key1": "value",
  "key2": "value",
  "key3": "value",
  "key4": {
   "subkey1": "value",
   "subkey2": "value"
  }
}
And what I want it to turn into:
obj1 = {
  "ns:key1": "value",
  "ns:key2": "value",
  "ns:key3": "value",
  "ns:key4": {
   "ns:subkey1": "value",
   "ns:subkey2": "value"
  }
}
This should be done dynamically, since this will be used for several different aspects of the same project. So I'm hoping to simply have a function that I pass 'obj1' into and have it spit out the converted JSON Object, no matter what I give it.
What would the easiest way to go about this be? Again, I'm not used to JavaScript, so examples are welcome.
PS. A CoffeeScript solution is also acceptable. I'm basically writing it out in JS then converting this using js2coffee.org.
 
    