value.key not working for passed json inside map function

Venki Yedidha venkatesh.yedidha at
Thu Aug 23 03:03:52 EDT 2012

Hi All,

       I have a map function which takes inputs for all countries:
       my bucket format is

      my json format is :

 $m=    ' {
    "IN": {
        "Internetusers": "12816",
        "population": "193161"
    "IS": {
        "Internetusers": "26907",
        "population": "571890"
    "CN": {
        "Internetusers": "800",
        "population": "1384"
    "US": {
        "Internetusers": "12487",
        "population": "105916"
    "AS": {
        "Internetusers": "12487",
        "population": "105916"
    "JP": {
        "Internetusers": "12487",
        "population": "105916"
$m = addslashes($m); //this just adds \ infront of " to escape double

Now I am accessing this inside a map function written in javascript(my
server side script is php),like:
   var k = '.$m.';
   when I am trying to access k[value.key], it throws an error saying
k[value.key][\"Internetusers\"] is undefined..
   On the other hand, giving a static value works fine for me..
  like k[\"JP\"][\"Internetusers\"] works fine....

I thought k[value.key] should work fine because my bucket keys and my json
keys are same...

I tried all these types.

k[value.key],k[\"'.value.key.'\"],k[\"'+value.key.+\"] etc

Please help on the above,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the riak-users mailing list