Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将以下 json 文本放在目标 c 中的字符串中。我该怎么做呢 ?
我需要 NSString jsonText = { "username" : "Test", "password" : "testing123" }
谢谢
NSString *jsonText = @" { \"username\" : \"Test\", \"password\" : \"testing123\" }";
您应该转义引号字符并在字符串文字之前添加@,以便您的代码变为
NSString *jsonText = @"{ \"username\" : \"Test\", \"password\" : \"testing123\" }";