客户端为我提供了一些树状结构的数据。它只是由YES / NO问题组成。结尾的结果是相对较小的字符串(少于100个字符),但是一些结尾结果以包含格式的大字符串结尾(制表符,换行符等)。
对于不同的系统,不仅仅有一个树状结构,所以我需要一种方法来识别它们。我目前只是将所有这些数据解析为一个json文件,但保持大结果的格式往往有点单调乏味。在格式化字符串时,iOS 5中的JSONSerialization非常挑剔。
无论如何,这是一个例子:
"Skin Assessment":{
"ID" : "1",
"Questions":[
"Have you completed a skin assessment?",
"Does your assessment include Colour, Temperature, Texture, & Turgor?",
"Were findings within expected range?"
],
"Answers":[
{
"YES":"",
"NO":"You must complete the skin assessment prior to documenting your findings."
},
{
"YES":"",
"NO":"You must complete the skin assessment prior to documenting findings."
},
{
"YES":"Document Colour as: \n\t- Consistent with genetic background\n\t- Pink\n\t- Pale\n\t- mottled\n\t- Cyanotic\n\t- Jaundiced\n\t- Flushed\n\nDocument Temperature/moisture as:\n\t- Warm, dry, intact \n\t- Cool\n\t- Clammy\n\t- Diaphoretic\n\nDocument Texture as:\n\t- Smooth\n\t- Rough \n\t- Dry\n\t- Moist\n\t- Scaly\n\t- Thick or Thin\n\t- Eczema (note colour)\n\t- Lesions (this will require extra documentation such as size, elevation, shape, colour, symmetry) \n\t- Wounds (this will require further documentation such as size, shape, discharge/drainage, dressing)\n\nDocument Turgor as:\n\t- Easily rises\n\t- Immediate return\n\t- Tenting?\n"
}
]
}