Reputation: 99
My GET JSON brings back from COUChDB {"total_rows":6,"offset":0,"rows":[ {"id":"51585142d8f2851d34c9b7dc8c003997","key":"itemName","value":{"nestedkey1":"nestedvalue1","nestedkey2":"nestedvalue2","nestedkey3":"nestedvalue2","nestedkey4":"nestedvalue4","nestedkey5"}},
I want to remove {"total_rows":6,"offset":0,"rows":[ {"id":"51585142d8f2851d34c9b7dc8c003997","key":"itemName"
So I am left with the wrapper/parent "value" that has the nested keys and nested values I really want and so it is presented in the following JSON format {"nestedkey1":"nestedvalue1","nestedkey2":"nestedvalue2","nestedkey3":"nestedvalue2","nestedkey4":"nestedvalue4","nestedkey5"}}, as my json
I've tried CouchB mapping/views and jquery client side function/result filtering but I'm new to this and could use some insight into achieving my objective
Upvotes: 0
Views: 278
Reputation: 2535
You should be able to achieve this using jQuery on the client side. You could do this in the success callback of get()
var value = [];
$.get( "url/to/view", function( data ) {
$.each(data.rows, function(index, row){
value.push(row.value);
});
});
That way, you have the rows in data
.
Upvotes: 0