Add build_json method