Start of convert json function