Send history in JSON to frontend