Added Newtonsoft.Json, corrected if else statement