将 NSString 转换为 NSDictionary - jsonserialization 错误 3840

Convert NSString to NSDictionary - jsonserialization error 3840

我在描述中有一个字符串作为输出- @"{\n \"40147089-db8b-4223-89ab-7a2f72ac57d6\" = {\n \"22337b85-d2cf-4079-8d5f-9804cb680f2c\" = (\n yes\n );\n \"87eeb49f-b34a-431b-8701-bd7f36bc91ea\" = (\n yes\n );\n };\n \"7262d43c-4d72-4e71-9097-6db5632d1f54\" = {\n \"22337b85-d2cf-4079-8d5f-9804cb680f2c\" = (\n yes\n );\n \"58ecb861-4372-412b-8740-a9f94260ed93\" = (\n yes\n );\n };\n}"

如何将其转换为 NSDictionary?总是 jsonserialisation 向我抛出 Error Domain=NSCocoaErrorDomain Code=3840 "No value for key in object around character 45."

这就是我在打印 ResponseObj 时得到的结果,其中 ResponseObj 的类型为 id

po responseObject

{
"159476cc-3e1f-4995-bf23-df41141dd8c5" = 2;
"6280ecfe-841e-4a35-8002-3e9e7327ba7d" = 2;
"64de3fc6-ff59-4e91-a2e7-f3ec904eecce" =     {
    "40147089-db8b-4223-89ab-7a2f72ac57d6" =         {
        "22337b85-d2cf-4079-8d5f-9804cb680f2c" =             (
            yes
        );
        "87eeb49f-b34a-431b-8701-bd7f36bc91ea" =             (
            yes
        );
    };
    "7262d43c-4d72-4e71-9097-6db5632d1f54" =         {
        "22337b85-d2cf-4079-8d5f-9804cb680f2c" =             (
            yes
        );
        "58ecb861-4372-412b-8740-a9f94260ed93" =             (
            yes
        );
    };
};
"83ec5c05-cb2f-4c49-b9a3-ab44c487bf55" =     {
    "2a8dd370-2f7e-4c8e-93d5-21102fbc82fd" =         {
        "957bdaba-b23d-4243-8384-62dfa46f0656" = work;
    };
    "b3e0aded-d57b-4159-9c33-c8b006282334" =         {
        "aba16653-bda0-4e89-b1c8-63df6faa7c10" =             (
            yes
        );
    };
    "d765038e-e85a-495d-9932-170852fbd86e" =         {
        "57646099-b717-4a2b-b9eb-2935548ae954" =             (
            yes
        );
        "957bdaba-b23d-4243-8384-62dfa46f0656" = play;
    };
};
"c81e7d71-6f1e-4b83-8740-c73ee52e3b0b" =     (
    2
);
}

请为您的数据使用 NSJSONSerialization。