Xojo.Core.InvalidArgumentException

I am encountering an issue with Xojo.Data.GenerateJSON().

AccountDiko is a Xojo.Core.Dictionary, but I get the error Xojo.Core.InvalidArgumentException on the last line of the code I posted.

Any idea ?

  dim AccountNme as string= DefineEncoding(Accountname+".accountjson", encodings.utf8)
    
  dim f as folderItem = FolderSaveDefaults
  
  f = f.child(AccountNme)
  
  Dim json As text
  json = Xojo.Data.GenerateJSON(AccountDiko)

Are you using String values in your xojo.core.dictionary (AccountDiko)?

I don’t know for desktop but on iOS that crashes the app when calling Xojo.Data.GenerateJSON

They are indeed screen values.

Thank you. I will look into this.

Is there any reason for using xojo.core.dictionary?

Dictionary will certainly work better, you can even mix String and Text values and get valid JSON output.

OK. Let me try.

OK. I have switched to regular dictionary and jsonitem.

No more crash :slight_smile:

Thank you Jeremie

2 Likes