parse json and calculate