Updated code to convert dictionary to json using Apple's API instead of JSONKit