Creating json for graph