Transform id and value into JSON