Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-519

FileReader.readAsText performs automatic JSON.parse

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 1.6.1
    • None
    • cordova-wp7 (DEFUNCT)
    • None
    • VS.NET 2010 and WP7.1 emulator

    Description

      After upgrading from 1.5 I find that FileReader.readAsText takes the liberty of performing a JSON.parse if my file happens to be a stringified JSON object. While this seems like a nice addition, my app connects to an ASP.NET web service which uses Microsoft's serialization objects to serve the JSON to my app. Because of this I have had to roll my own JSON parse and stringify functions to deal with Microsoft's version of date serialization. I am able to work with the automatic JSON.parse by checking for typeof == "object" and if that is what FileReader.readAsText has returned then I go ahead and use my own JSON.stringify and JSON.parse and go along on my way. But I thought it was odd that this automatic JSON.parse would happen in the first place, so I submit this as a bug in case someone was doing some testing/debugging and accidentally left a line of code in place that should really not be there. I can live with it if it is intentional, but I think it would be more intuitive to not do automatic JSON operations that the function name does not indicate.

      Attachments

        Activity

          People

            purplecabbage Jesse MacFadyen
            offshorewahoo Alan Neveu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: