check json values before assigning, updated tests