use JSON.generate instead of to_json