嵌入图像和文本的JSON数据(SWIFT)

时间:2015-12-08 15:48:25

标签: ios json swift

嘿伙计们我有点麻烦,我想帮助搞清楚。我正在使用一些JSON数据。 JSON将返回一个段落,并在段落内部给出一个图像。下面显示了JSON结果以及CMS如何添加图像。所以我将没有图像的身体添加到textview,这样可以正常工作,但如果他们嵌入图像就会崩溃。如何在textview中显示图像或跳过图像,只是放置内容或其他内容。代码示例,如果你可以

Protected Sub SheetSave_Click(sender As Object, e As EventArgs) Handles SheetSave.Click

    Response.Clear()
    Response.Buffer = True
    Response.AddHeader("content-disposition", "attachment;filename=gvtocsv.csv")
    Response.Charset = ""
    Response.ContentType = "application/text"
    Dim sBuilder As StringBuilder = New System.Text.StringBuilder()
    For index As Integer = 1 To DisplaySuppliers.Columns.Count - 1
        sBuilder.Append(DisplaySuppliers.Columns(index).HeaderText + ","c)
    Next
    sBuilder.Append(vbCr & vbLf)
    For i As Integer = 1 To DisplaySup.Rows.Count - 1
        For k As Integer = 1 To DisplaySup.HeaderRow.Cells.Count - 1
            If (DisplaySup.Rows(i).Visible = True) Then
                sBuilder.Append(DisplaySup.Rows(i).Cells(k).Text.Replace(",", "").Replace(" ", "") + ",")
            End If
        Next
        sBuilder.Append(vbCr & vbLf)
    Next

    Response.Output.Write(sBuilder.ToString())
    Response.Flush()
    Response.[End]()
End Sub

现在我将向您展示如何返回JSON

CMS
Lorem ipsum Lorem ipsum Lorem ipsum 
![Conference Centre]
//images.places.com/434432/4234328423rf234/Conference_Centre.jpg
more of the same

编辑JSON(我刚添加了一些空格,以便您可以更好地看到它)

JSON
“body" : "Lorem ipsum Lorem ipsum Lorem ipsum\n\n![Conference Centre](\/\/images.places.com\/434432\/4234328423rf234\/Conference_Centre.jpg)\n\nmore of the same"

0 个答案:

没有答案