Fix NullPointerException when storing publisher with no graphs.

toJsonArray method was incorrect, we should return empty array instead
of null.