Bug? Map.Put does not work if the map comes from the jsonparser

Alexander Stolte

Expert
Licensed User
Longtime User
I have noticed since I updated xcode for ios 17 something that worked reliably before no longer works.

I am parsing a json string and want to add another key to the map. This does not seem to work anymore

B4X:
    Dim parser As JSONParser
    parser.Initialize($"{"access_token":"eyJhbGxxx","token_type":"bearer","expires_in":3600,"expires_at":1697932247,"refresh_token":"F6XSgMBXZeKx8IA","user":{"id":"5037254ac","aud":"authenticated","role":"authenticated","email":"[email protected]","email_confirmed_at":"2022-07-12T19:36:56.54274Z","phone":"","confirmation_sent_at":"2022-07-12T19:36:30.933934Z","confirmed_at":"2022-07-12T19:36:56.54274Z","recovery_sent_at":"2023-08-26T11:33:40.782795Z","last_sign_in_at":"2023-10-21T22:50:47.506626395Z","app_metadata":{"provider":"email","providers":["email","google"]},"user_metadata":{"avatar_url":"https://lh3.googleusercontent.com/a/AAcHTtxxsYJysExx96-c","email":"[email protected]","email_verified":true,"full_name":"Alexander Stolte","iss":"https://accounts.google.com","name":"Alexander Stolte","picture":"https://lh3.googleusercontent.com/a/AAtestEksxxxuWcQ=s96-c","provider_id":"104202063xx5691","sub":"10420xx385691"},"identities":[{"id":"50394908xx53e7d7254ac","user_id":"5039490xx7254ac","identity_data":{"email":"[email protected]","sub":"50394908-c978-4xxx53e7xac"},"provider":"email","last_sign_in_at":"2022-07-12T19:36:30.929702Z","created_at":"2022-07-12T19:36:30.929739Z","updated_at":"2022-11-25T00:00:00Z"},{"id":"10420xx845385691","user_id":"503949xxdf-80af-653e7d7254ac","identity_data":{"avatar_url":"https://lh3.googleusercontent.com/a/AAcHTteiOo7S0Ux8gXnrhqFixxxx-FZe6GlZuWcQ=s96-c","email":"[email protected]","email_verified":true,"full_name":"Alexander Stolte","iss":"https://accounts.google.com","name":"Alexander Stolte","picture":"https://lh3.googleusercontent.com/a/AAcHTteitestxB-FZe6Gxx=s96-c","provider_id":"104202xx85691","sub":"10420xxx385691"},"provider":"google","last_sign_in_at":"2023-08-29T16:15:51.697486Z","created_at":"2023-08-29T16:15:51.697527Z","updated_at":"2023-08-31T14:01:28.811797Z"}],"created_at":"2022-07-12T19:36:30.925639Z","updated_at":"2023-10-21T22:50:47.508399Z"}}"$)
    Dim tmp_result As Map = parser.NextObject.As(Map)
    tmp_result.Put("success",True)
    Log(tmp_result.ContainsKey("success")) 'Log says: false
 

Attachments

  • Map Bug.zip
    3.7 KB · Views: 60

Erel

B4X founder
Staff member
Licensed User
Longtime User
It was always readonly.
There is a technical / performance reason for it.

 
Top