Android Question How do I see the contents of my JSON String?

Discussion in 'Android Questions' started by davepamn, Sep 21, 2015.

Similar threads

B4A Tutorial Text files
B4A Tutorial Flickr Viewer
B4A Tutorial Android Serial tutorial
B4A Question Bluetooth reception problem
B4A Question Please help me.
B4A Question Service not working
  1. davepamn

    davepamn Active Member Licensed User

    I need to inspect in debug my json string returning from the server.

    The debug "copy to clipboard" truncates the data.

    The JSON parser seems to throwing away some rows in the JSON string

    Sub HandleContracts(Job As HttpJob)

    If Job.Success = False Then
    ToastMessageShow("Error downloading data."True)
    End If

    Dim TextReader1 As TextReader

    Dim Text As String
        Text = StripTags(TextReader1.ReadAll )

    Dim p AsJSONParser

    end sub

    Sub StripTags(sJSON As StringAs String

    Dim Text As String=""
        Text = sJSON
    Do While Text.IndexOf(">")>0
    Dim StartTag As Int
    Dim EndTag As Int
    Dim S As StringBuilder

    End Sub
  2. eurojam

    eurojam Well-Known Member Licensed User

  3. davepamn

    davepamn Active Member Licensed User

    My program is getting the json string out of debug. I may try and write it to a text file
  4. DonManfred

    DonManfred Expert Licensed User

    or you may change the server side and just return less data so you can see the hole answer in the logs, copy it into the jsontree tool to create the b4a code for you
  5. sorex

    sorex Expert Licensed User

    or put the url in your desktop/laptop browser
  6. sirjo66

    sirjo66 Well-Known Member Licensed User

    Where you want to inspect the string, insert this line:
    File.WriteString(File.DirDefaultExternal, "myfile.txt")
    Run the program and then you can inspect myfile.txt file with the complete string.
    You can also copy myfile.txt from device to a PC and open it with your editor

    DonManfred likes this.
  7. davepamn

    davepamn Active Member Licensed User

    I was able to inspect the json string using a tablet editor.
    Last edited: Sep 22, 2015
    sirjo66 likes this.
  8. davepamn

    davepamn Active Member Licensed User

    I was able to shorting the json string but it still exceed 4000 characters. In my opinion, b4a needs to improve the debug capabilities and features.
  9. davepamn

    davepamn Active Member Licensed User

    This was an excellent tool. I saved my json string to file, transferred the file to my desktop, and cut and paste the json string in the html page and parsed it. The json parsed correctly and helped me feel confident in the parser.
    sirjo66 and DonManfred like this.
  10. DonManfred

    DonManfred Expert Licensed User

    Yes, it is one of @Erel masterpieces of useful Tools :)
  11. DonManfred

    DonManfred Expert Licensed User

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice