Empty JSON response can't be serialized

Hi,
FB4 B2
I was getting an error from JSONSerializer object when the returned array has no elements inside. the returned JSON encoded raw data is a simple array representation: []. Is there anything I'm doing wrong, server side is php and I'm using PHP's json_encoder function. When I have elements inside the serializer works well.
r. Sandor
Error:
Error: Error while Parsing
at com.adobe.serializers.json::JSONDecoder/parseValue()[C:\perforceGAURAVP01\depot\flex\ide_ builder\com.adobe.flexbuilder.dcrad\serializers\src\com\adobe\serializers\json\JSONDecoder .as:249]
at com.adobe.serializers.json::JSONDecoder/parseArray()[C:\perforceGAURAVP01\depot\flex\ide_ builder\com.adobe.flexbuilder.dcrad\serializers\src\com\adobe\serializers\json\JSONDecoder .as:431]
at com.adobe.serializers.json::JSONDecoder/parseValue()[C:\perforceGAURAVP01\depot\flex\ide_ builder\com.adobe.flexbuilder.dcrad\serializers\src\com\adobe\serializers\json\JSONDecoder .as:221]
at com.adobe.serializers.json::JSONDecoder/decode()[C:\perforceGAURAVP01\depot\flex\ide_buil der\com.adobe.flexbuilder.dcrad\serializers\src\com\adobe\serializers\json\JSONDecoder.as: 178]
at com.adobe.serializers.json::JSONSerializationFilter/deserializeResult()[C:\perforceGAURAV P01\depot\flex\ide_builder\com.adobe.flexbuilder.dcrad\serializers\src\com\adobe\serialize rs\json\JSONSerializationFilter.as:102]
at mx.rpc.http::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::processResult()[E:\dev\gumbo_beta2\frameworks\ projects\rpc\src\mx\rpc\http\AbstractOperation.as:929]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[E:\dev\gumbo_beta2\frameworks\ projects\rpc\src\mx\rpc\AbstractInvoker.as:313]
at mx.rpc::Responder/result()[E:\dev\gumbo_beta2\frameworks\projects\rpc\src\mx\rpc\Responde r.as:56]
at mx.rpc::AsyncRequest/acknowledge()[E:\dev\gumbo_beta2\frameworks\projects\rpc\src\mx\rpc\ AsyncRequest.as:84]
at DirectHTTPMessageResponder/completeHandler()[E:\dev\gumbo_beta2\frameworks\projects\rpc\s rc\mx\messaging\channels\DirectHTTPChannel.as:446]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()

Another possible workaround is use a drop-in replacement to the built-in JSONSerializationFilter:
https://github.com/audreyt/plurk/blob/master/src/com/serialization/json/JSONSerializationF ilter.as
https://github.com/audreyt/plurk/blob/master/src/com/serialization/json/JSON.as
All it takes is changing the "import com.adobe.serializers.json.JSONSerializtionFilter" lines in service
class's templates into "import com.serialization.json.JSONSerializationFilter", and empty arrays would start working.
Theoretically one can also do this, though I have not tested it yet:
    SerializationFilter.registerFilterForResultFormat( 'json', new JSONSerializationFilter ());

Similar Messages

  • How to fix a problem with the order of strings in a JSON response for a CFHTTP request?

    Good morning, guys! (It's 10:50 a.m. in Brazil)
    First of all, I'm still new at CF and my questions may seem too much silly and my English's not the best, so, please be patient with me. hehe
    Well, I'm accessing a link via CFHTTP that gives me a JSON response. I'm not familiar with JSON yet, so I'm working it as a string and using string functions (Find,RemoveChars,Replace,etc), but it happens to me that I'm receiving a certain kind of order of the strings list from the JSON when I access it directly from the browser and other kind of order totally different when I access it from the CFHTTP.
    I only figured it out because I was working at home with my code and there everything went just fine as expected. Then I brought to my job to develop a little bit more as soon as I get a free time and here my code doesn't work anymore. When I took a look at the JSON by a CFOUTPUT, I realized the strings were in a different order.
    Does anyone know why is it happening?
    Link to the JSON: http://sigmine.dnpm.gov.br/ArcGIS/rest/services/extra/dados_dnpm/MapServer/0/query?text=83 0620/2012&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelInter sects&where=&returnGeometry=true&outSR=&outFields=FID,Shape,PROCESSO,ID,NUMERO,ANO,AREA_HA ,FASE,ULT_EVENTO,NOME,SUBS,USO,UF&f=pjson
    Basic code simplified to find out that the order of strings were coming different when access by CFHTTP:
    <cfhttp url="#URLAbove#" method="get" result="DadosDoDNPM" charset="utf-8" timeout="10000" />
    <cfset DadosJSON = deserializeJSON(DadosDoDNPM.FileContent) />
    <cfif arrayLen(DadosJSON.features)>
        <cfset CodigoFonteJSON = ToString(serialize(DadosJSON.features)) />   
        <cfoutput> #CodigoFonteJSON# </cfoutput>
    </cfif>
    Is there a way to fix it and to make my code work everywhere?
    If it matters, I use Railo at home and at my job.
    Since now, I thank you.

    When you deserialize JSON data, ColdFusion converts it into native structures and arrays (roughly equivalent to JavaScript objects and arrays).  In ColdFusion, structures are unordered (that is, they don't maintain keys in any particular ordered sequence).
    This really shouldn't be a problem though, at least not if you just want to work with the data contained in the deserialized JSON structure.  So DadosJSON should be a native ColdFusion structure, and you can interact with it like any other structure in ColdFusion.  In fact, you should not have to re-serialize it at all unless you need to send it to an external application using JSON.
    Why are you reserializing the data?  And why use serialize() instead of serializeJSON()?
    -Carl V.

  • Cache JSON response

    Hi,
    I used following blog to Ajaxify a component
    http://blogs.adobe.com/mtg/2011/11/building-components-in-adobe-cq5-part-2-a-tutorial-on-j query-ajax-and-sling.html
    Basically this talks about creating a JSP file in conponent with name [ComponentName].json.POST.jsp to allow running custom code to return JSON.
    My component is doing JCR search based a parameters and returning a JSON list (which could be different for different parameters)
    So all went well till I discover performance issues with AJAX response time.
    Is there a way in CQ5 to cache result of JSON and have it auto every x mins?
    Thanks in adavnce.

    Thanks Justin. I have couple of questions to understand the proposed solution
    1) Do you know how can I convert component POST to GET (for the reference blog). I tried renaming to myajaxsample.json.GET.jsp but it breaks component input dialog. Note that this component is making Ajax call to
    <%= currentNode.getPath() %>.json
    2) Can I force cache to update for cases when data for a particular JSON request is updated?

  • Can we swap serial Numbers for an item instance in Install Base

    Hi,
    Can anyone please let me know if we can swap/replace serial number of an item instance in Install Base. If so, please let me know how to do it.
    Thanks in Advance.

    Oh, I did find where it is defined. It's a form function under Setup in Oracle Install Base Admin responsibility. I think you would have had it if you had CMRO installed.
    Following are the values in the form:
    Application Name: Complex Maintenance Repair and Overhaul
    Transaction Typa: ITEM_SERIAL_CHANGE
    Transaction Name: Item Serial Change
    Description: Item Number and or Serial Number Change
    In Out: Checked
    Alka

  • How to remove 'd' wrapper from odata json response ?

    Hello,
    from example request :
    /sap/opu/odata/sap/ZQM_CONFIRMATION_SRV/Check_batch_and_cust?$format=json&WERK='ASJV'&PDATUM=''&CHARGE='140005'&MENGE=''&VORG=''
    response json looks like this:
    {"d":{"__metadata":{"id":"http://x:8000/sap/opu/odata/sap/ZQM_CONFIRMATION_SRV/CHECK_BATCH_AND_CUSTOMERSet(Charge='',Menge='',Pdatum='',Vorg='',Werk='')","uri":"http://x:8000/sap/opu/odata/sap/ZQM_CONFIRMATION_SRV/CHECK_BATCH_AND_CUSTOMERSet(Charge='',Menge='',Pdatum='',Vorg='',Werk='')","type":"ZQM_CONFIRMATION_SRV.CHECK_BATCH_AND_CUSTOMER"},"Charge":"","Menge":"","Pdatum":"","Vorg":"","Werk":"","Msg":"OK","Name1":"WIN-Warth GmbH","Name2":"","Status":"0"}}
    I want to remove wrapper 'd'
    Any ideas ?
    regards
    Lucas

    Hello Lukasz,
    In my openion your json response will always be encapsulated in a standard structure/format as u have shared. I do not see any way u can remove ' d ' from the json response in GW level
    Regards,
    Ashwin

  • Create dynamic controls from JSON Response

    I have a requirement to create a group of checkbox with lebels in a page from JSON response.
    The JSON response is
        "data": [
                "CodeStatus": "Red"
                "CodeStatus": "Orange"
                "CodeStatus": "Green"
                "CodeStatus": "Yellow"
    the  design is:
    the box is vertically scrollable, as it can have more color codes.
    Can anyone suggest how to design the above?
    If one can provide the implemantation code, that would be very good as I have very time to implement it.

    Have a look at templates and for more complex scenarios factory functions, which give you the ability to dynamically create controls from model data.
    SAPUI5 SDK - Demo Kit
    Regards,
    Jason

  • I am deleting files through my trash in my macbook pro (2010) and then emptying the trash can, but my hard disk space is not increasing! i recently upgraded to lion and the problem is new, wasn't the same with snow leopard! HELP!!!!!

    i am deleting files through my trash in my macbook pro (2010) and then emptying the trash can, but my hard disk space is not increasing! i recently upgraded to lion and the problem is new, wasn't the same with snow leopard! HELP!!!!!
    When i press command+I (Get Info) i see that there is 140 GB "Available Space" on my hard disk but when i click on my hard disk icon on the desktop, and then press "space" i only see 102 GB free!! What the f*???
    Please HELP!!!!!! Getting second thoughts on Lion!!!!

    Hi b,
    Have you restarted yet?

  • TS4153 how to empty my trash can in a mac mini

    why is it so hard to empty my  trash can. like PC you have an option if you want the file that I delete go to Trash or not. please let me know what to do. because I wanna delete empty my trash but it takes for ever. thank you

    De-select Empty Trash securely:

  • Help! I synced my iCal from my old iPhone to iCloud. It worked great. I've done this because I'm switching to a Samsung phone and need to sync my iCal to my Google calendar. In attempting to do so today, my iCal is empty. How can I retrieve my iCal info??

    Help! I synced my iCal from my old iPhone to iCloud. It worked great. I've done this because I'm switching to a Samsung phone and need to sync my iCal to my Google calendar. In attempting to do so today, my iCal is empty. How can I retrieve my iCal info??

    This was EXACTLY what I needed about the purchases I made from my device. However, is there a way to re-download other ones you've made from a computer? Because I realized some of them were not just purchased from my device.
    This is a picture of what it looks like now:
    http://tinypic.com/r/107quxu/7
    As you can see, the stuff circled in red doesn't give me an option to download from Cloud Beta because it already says "downloaded".
    any way to get around that?

  • In Responses, Can I export the data in a pdf form excluding null data?

    In Responses, Can I export the data in a pdf form excluding null data?

    Let me make sure I understand the request...  There is a feature in the Response table to "Save Response as PDF Form" and you'd like to do this excluding the null data (unanswered questions).  If that is correct it is not supported, the "Save Response as PDF form" will save a PDF that is the entire form filled out as the user filled it.
    Thanks,
    Josh

  • I'm running iPhoto '08 version 7.1.5. My collection of 25,000  photos on iPhoto library is completely empty. How can I get them back?

    I'm running iPhoto '08 version 7.1.5. My collection of 25,000  photos on iPhoto library is completely empty. How can I get them back?
    I dragged one photo to the My Pictures folder in Finder. I knew it was just one photo because it was the only one highlighted in yellow. When I saw it in Finder, it was labled iPhoto. I thought it was the wrong picture, so in Finder I deleted the file. When I got back to iPhoto, EVERYTHING was missing. Events, photos, recent, and even trash. At this point, I went into my Trash. I searched for iPhoto and iPhoto was there. I opened it and it was still empty. All I want to do is to get my collection of photos back!

    Best solution is to load your backup from before you did this?
    Where did you drag the photo from?
    Have you tried dragging it from the trash to the desktop?  What size is it?
    What size is your iPhoto library in the pictures folder?
    LN

  • Please help me. I've just lost my iphone so I related to my backup contacts on icloud to get my contacts back. But my contacts only show at the first time and then they dissappeared, my contacts was empty. How can I see my contacts?

    Please help me. I've just lost my iphone so I related to my backup contacts on icloud to get my contacts back. But my contacts only show at the first time and then they dissappeared, my contacts was empty. How can I see my contacts?

    If they aren't on icloud.com they are no longer in iCloud.  If you don't have another backup, I'm afraid they're gone.

  • I purchased Adobe Photoshop Elements 12. Logged in and can not get serial number. Says it is incorrect. Going in circles.

    Can't get serial number for Photoshop Elements. I'm logged in. I have a redemption code and also codes on the back of the box. nothing works and am running in circles. I want to install and use it and can't because I can't get the correct serial number. On the front of the box it says use the card (with redemptiom code to receive the serial number.HELP!!!

    Dear Brian,
    I activated my product in August of 2014.  I had it a few months, October, when my computer crashed.  Therefore I had to go back to Adobe tell them what happened, and then until December I had noticed that it said that I had a trial copy.  I was not worried, as I had the serial number.  it was working, but in January I got a message that my "trial" copy had expired. 
    At that time I had contacted Adobe and was told that because it was beyond the 3 months, they would no longer help me.
    Therefore, at one point, when the computer crashed, I had not deactivated the program.  But Adobe had gotten it working for me again. 
    I do not know what happened between October and December to have changed the software from a real copy to a trial copy.
    Now to your patient questions.
    As you wrote, that is what happens to the point of getting the trial copy, but when I follow the process through, I get a message that my "trial copy has expired".    When I go the the editor, the whole process loops again, sign in, trial copy, licence page, add serial number, then the message that the trial has expired.
    When I got that message the first few times months ago, I went back to the Adobe web site and downloaded another copy.  (I have done this numerous times)  It still said that I had a trial copy and that it had expired, there is a box to licence this software, when I click that, I have to sign in again, This time I also had gone to the Adobe web site signed in and left it open, while I put in the serial number, hoping that would help (have also tried that before).  It waits and then the Editor/Organized box comes up again.  When I go to the Editor, it tells me that this is a trial copy which has expired and it starts all over again.
    I was so frustrated, that I waited a couple of months to try it again.   The thinking was that there was some glitch that would work it self out and I could again  down load a clean copy of the original, not a trial.  (I do not know how I keep getting a trial copy of PSE 12, as it is not even offered on the site.)
    The crazy thing is this morning when I turned on my computer, I had an update for the Adobe PSE 12 and Camera Raw.  Probably because I had downloaded a copy again. 
    When I go the the web site to down load a copy of the PSE !2, I am doing it from the My accounts/ products page and downloads.  I have left the web page open to copy the serial number from that page, although it always matches my notes. 
    ThanksT

  • How can I get serial numbers or the free versions of Adobe, Air, Flash Player 14, and Reader XI Pro

    How can I get serial numbers or the free versions of Adobe, Air, Flash Player 14, and Reader XI Pro that I had installed on my computer before Microsoft crashed my computer and I had to do a fresh install? I finished reinstalling Win 8.1Pro on my computer thanks to Microsoft Lvl 1 Techies corrupting my Command Structure so nothing would work. I had recently taken a picture of my installed programs (control panel, uninstall programs list) so that I would be able to reinstall everything I needed. I can't seem to find an email for the Reader which I remember paying for, the others I believe were free installs. Can anyone help me out.

    Safari Version 5.0.5  <  from your first post
    5.0.5 is an outdated version of Safari.
    There is an update available for Safari for version 5.1.1
    That may help.
    Click your Apple menu icon top left in your screen the click Software Update
    Restart your Mac after the updates are installed.
    Try full screen ...
    If you have problems using Software Update from the menu you can use the standalone installer here >  Safari 5.1.1

  • Serial code invalid for downloading 9.0 on one computer, and can't find serial number of acrobat xi on other computer?

    serial code invalid for downloading 9.0 on one computer, and can't find serial number of acrobat xi on other computer?

    Lost information
    https://www.adobe.com/account.html for serial numbers or subscriptions on your Adobe page... or
    Lost serial # http://helpx.adobe.com/x-productkb/global/find-serial-number.html
    -http://helpx.adobe.com/creative-suite/kb/error-serial-number-valid-product.html

Maybe you are looking for