improved toJSON(dictionary: XPCDictionary) mostly to use NSJSONSerialization