PDA

View Full Version : [FIXED] - Update 341 JSON.stringify cannot serialize cyclic structures.



ashapiro75
27 Mar 2012, 4:06 AM
I was trying to work with a project that I had going yesterday with build 337 that worked fine, it would load my data. I upgraded to 341 and now I get JSON.stringify cannot serialize cyclic structures.

To test what I did then was go into the directory where the json file was being stored and I removed it. I figured I would get some kind of missing file or object type error. Instead I got the same error. JSON.stringify cannot serialize cyclic structures.

So I don't think it had anything to do with my data format, my data format is still working on my mac at home which is version 337.

jjohnston
27 Mar 2012, 7:42 AM
Would you be able to provide the project and data file that are triggering this error?

anthonyterrell
28 Mar 2012, 6:07 AM
I have received this error as well while testing someone else's nested list code. There is another related thread (http://www.sencha.com/forum/showthread.php?182003-Nested-List-example.&highlight=JSON.stringify+serialize+cyclic+structures.) with the same issue. I wonder if this is just an issue with the newest build?

Thanks

joostvanhassel
28 Mar 2012, 6:59 AM
I seem to have the same problem since 341 on all my Json Stores (that all have a RestProxy).

Sample code:



Ext.define('MyApp.store.CustomerStore', {
extend: 'Ext.data.Store',
requires: [
'MyApp.model.Customer'
],

config: {
model: 'MyApp.model.Customer',
storeId: 'CustomerStore',
proxy: {
type: 'rest',
url: 'http://localhost:81/Customer/',
reader: {
type: 'json',
messageProperty: 'ErrorMessage',
rootProperty: 'Customers'
}
}
}
});



Might I add that this problem only occurs within Designer? I get the error if I use 'Load Data', if I test my application in a browser, loading stores works just fine.

Thought: maybe the 'rootProperty' of the JsonReader isn't respected in Designer since build 341?

ashapiro75
28 Mar 2012, 7:07 AM
I don't have the project as it was anymore, however the thread that was referenced here does have a project that I was having this issue with as well.

Unfortunately I can not recreate the error, it just seems to happen randomly. The next time it happens I will save off the project and post a copy of it.

jjohnston
28 Mar 2012, 7:29 AM
Thanks guys. I have tried reproducing this based on the info here:
- Combinations of rest proxy pointing to a local json file, with json reader plus rootProperty
- The sample project linked to from the other thread, using the nested json tree data supplied there as well as my own

In all cases the store is able to load its data correctly without giving this error. I'm sure there's some edge case I'm just not hitting. If any of you can provide a testcase project that triggers this it would help immensely.

joostvanhassel
28 Mar 2012, 7:39 AM
Euhm, well I just copied some of my code (the Model and the Store, Proxy & Reader) over to a new project to provide you with a sample; everything works fine in the fresh project (:|.

Restarted Designer on my full project: problem solved! Stores now all load Data (no changes to code).

As it doesn't seem to be a problem in code; do you still need my sample project?

anthonyterrell
28 Mar 2012, 7:47 AM
When testing the project noted from the related thread, I had to upgrade (http://cl.ly/FOk5) the project to open it. But still am getting the same error.

jjohnston
28 Mar 2012, 7:57 AM
@joostvanhassel: Interesting. If your project doesn't throw the error anymore then it wouldn't be much help. But if this crops up again for you can you go ahead and send it to us, either by PM or by email to designer.feedback@sencha.com

@anthonyterrell: I did the same thing, and after the upgrade process it opened without issue and the store loads its data without error (after updating my URL Prefix to the correct path for my local server). Did you take any special steps other than opening the project and loading the store?

anthonyterrell
28 Mar 2012, 8:02 AM
I simply downloaded the project and opened up the sencha designer file. After the update process I right clicked the store and loaded the data, this is where I get the error. I did not try and preview the app or set my url prefix to my local environment.

Currently running v2 Build 341. Thanks for the assistance!

joostvanhassel
28 Mar 2012, 8:11 AM
@ashapiro75: can you try opening Designer first and then (from within Designer) open the project? Does the error still occur? I noticed opening a (upgraded) project this way slightly differs (see: this post (http://www.sencha.com/forum/showthread.php?191416-Project-upgrade-error-message))

anthonyterrell
28 Mar 2012, 8:17 AM
@joostvanhassel I had to open Designer first, as just clicking on the file itself never seemed to launch Designer fully.

jjohnston
28 Mar 2012, 8:33 AM
@anthonyterrell: I tried taking those same exact steps, without updating the url prefix this time. I do get an error message, but it's this one:

Unable to load data using the supplied configuration.
Open in Browser: tree.json

Completely expected since it's trying to resolve tree.json at an unknown location. I don't get the JSON.stringify message.

joostvanhassel
28 Mar 2012, 8:42 AM
@ashapiro75: maybe you can post the project as it is updated at your PC/mac now.

Just to be sure: have you closed all instances of Designer before opening a new Designer and opening the project?

jjohnston
3 Apr 2012, 4:54 PM
Hi guys, we left off with me being unable to reproduce the issue with the provided project; I'm wondering if you are still seeing the issue with the updated beta build 355?

worthlutz
4 Apr 2012, 4:12 PM
I see in in a message by clicking a a red explanation point by my store after starting up my project in Designer(Update 360).

I think that it relates to autoLoad. Start a new project and add the model and store below. Save it and close Designer and then reopen it. The red error explanation point will be beside the Store. Clicking gets the message.

If I remove autoLoad the message goes away.

The store works in my project.

I hope this helps.

Worth




/*
* File: app/model/MapServerMap.js
*
* This file was generated by Sencha Designer version 2.0.0.
* http://www.sencha.com/products/designer/
*
*/


Ext.define('MyApp.model.MapServerMap', {
extend: 'Ext.data.Model',
config: {
fields: [
{
name: 'mapUrl'
}
],
proxy: {
type: 'ajax',
url: './php/getMap.php',
reader: {
type: 'json',
rootProperty: 'map'
}
}
}
});

/*
* File: app/store/MapServerMaps.js
*
* This file was generated by Sencha Designer version 2.0.0.
* http://www.sencha.com/products/designer/
*
*/


Ext.define('MyApp.store.MapServerMaps', {
extend: 'Ext.data.Store',
requires: [
'MyApp.model.MapServerMap'
],


config: {
autoLoad: true,
model: 'MyApp.model.MapServerMap',
storeId: 'MyStore'
}
});

joostvanhassel
4 Apr 2012, 4:26 PM
@jjohnston: I'm not having the issue anymore, I'm fine (unrelated; it might be nice if this forum somehow could show if a question is answered in the threadlist, I guess this would help you guys browsing through all questions too)

@worthlutz:
1) is the error the same as in the threads title?
2) does the error occur only in Designer, or does your project not load any data while testing in a browser either?
3) could you call the exact url directly in your browser and post the output, so we can have a look to help you out?

worthlutz
5 Apr 2012, 4:42 AM
The error only occurs in Designer and is the same as the thread title.

Could the problem be that the rootProperty, "map", object in the returned data has both the "extent" and "mapUrl" properties? Does the model have to "exactly" match the returned data object or can it pull out the required pieces if only some are needed in this case?



{"success":true,"parceldata":[],"map":{"extent":{"minx":2211826.2604003,"miny":648503.81250018,"maxx":2212980.7500002,"maxy":649623.93750018},"mapUrl":"\/tmp\/4f7d8e71_6a90_0.png"},"errorMessages":["NumRows = 1"],"ownerParcelList":[["SMITH, DAISY MAE STANCIL","14038026"]]}


w/ added linefeeds and spacing:


{
"success":true,
"parceldata":[],
"map":{
"extent":{"minx":2211826.2604003,"miny":648503.81250018,"maxx":2212980.7500002,"maxy":649623.93750018},
"mapUrl":"\/tmp\/4f7d8e71_6a90_0.png"
},
"errorMessages":["NumRows = 1"],
"ownerParcelList": [["SMITH, DAISY MAE STANCIL","14038026"]]
}

anthonyterrell
5 Apr 2012, 4:55 AM
I will be checking this shortly as well, I'm beginning development on the project today. Thanks for revisiting the thread.

anthonyterrell
5 Apr 2012, 5:05 AM
Going through the same steps as before I receive the error still, running the latest build.

Download the project from this thread (http://www.sencha.com/forum/showthread.php?182003-Nested-List-example.&highlight=JSON.stringify+serialize+cyclic+structures.) named nl3.zip
Open Sencha designer and choose the project file within the folder
Confirm I want to update the project
Click load data - receive error.

joostvanhassel
5 Apr 2012, 5:12 AM
@worthlutz: Sorry, haven't got time to check this out for you, but maybe you can try this:
- copy the json to a static file on a server (something.json)
- point your proxy there
- see what happens if you remove elements that are not needed

This might not solve your problem directly (if you can't edit the service for example), but it might help the guys at Sencha figure this out if you can pinpoint what's causing the problem.

snouhaud
7 Apr 2012, 10:43 PM
Hi,

I have the same error with build 363 here you can recreate error:

- Create Json store
- Copy json file on root directory of designer project
- in proxy enter in url the name of json file (it's relative path)
- When i click load data in Store i have error JSON.stringify cannot serialize cyclic structures.
- If i put the complete URL: http://server/path/file.json it's work
- if i put a wrong file name in url field i have the same error

Hope that help

jjohnston
9 Apr 2012, 3:40 PM
Thanks guys for sticking with me through this. I was finally able to reproduce the error and resolve the cause.

The reason I was not seeing the error was that it only happens if the proxy's XHR object gets an empty responseText -- I was getting non-empty responses so it would not happen.

Look for the fix in an upcoming update.

lagear
7 Nov 2012, 3:23 PM
Could you please tell me where did you fix this bug, I dont want to migrate to 2.1, so I'd like to stay on 2.0.1.1.

Thanks

aconran
7 Nov 2012, 3:36 PM
This was a bug in Architect that was fixed in April. It does not have anything to do with the touch version you are using.