-2

I have a Dictionary<String, Any> Data in the following format. I need to extract the values from it.I am unable to extract the values, initially it looked to me as JSON but it's of type Dictionary<String, Any>. Can anyone help me out.

 **{
        message =     {
            "pn_apns" =         {
                aps =             {
                    alert =                 {
                        body = "Andy - Picture added!";
                        roomId = 1611711512726;
                        title = "New chat on flag - New flag ";
                    };
                    sound = default;
                };
            };
            senderId = "XXXX@XXXXX";
            text = "Euclid%20Ave./Flag%20%26%20Chat/New%20flag%20/Original/1AF3956D-AEC4-485C-B8C2-3F97AEE05C58.png";
            type = P;
            uuid = "XXXXXXX-70CB-4301-DDDD-FFFFFFFF";
        };
        timetoken = 16117629931914202;
        uuid = "XXXX@XXXXX";
    }**
3
  • 1
    1) That is not json, please post the raw json string 2) When printing the error then use print(error) instead for a more informative error message Commented Jan 28, 2021 at 20:12
  • Thanks for correcting me with that it's a Dictionary<String, Any> Commented Jan 28, 2021 at 20:55
  • Maybe you should start with reading up on dictionaries Commented Jan 28, 2021 at 20:58

1 Answer 1

2

This isn't a JSON.

Look at https://www.json.org/json-en.html site.

To check the string, use https://jsonlint.com

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks it's of the type Dictionary<String, Any> in swift. It looked liked JSON to me. Thanks for correcting me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.