Creating dynamic json from merged results.