Thanks for clearing that up.
I am using the fwSON.Write method but after reading your response, I realized why am I getting the rows and count properties...I have my object created with fwCursor class which is identical to the output that the fwJSON.WriteCursor method and that is what I overlooked.
SELECT * FROM aTable INTO CURSOR aCursor
IF RECCOUNT() > 0
* Set the content type to text/plain to prevent some Ajax frameworks from complaining
Response.ContentType = "text/plain"
fwJSON.Beautify = .T.
JSONResponse = CREATEOBJECT("CUSTOM")
JSONResponse.aaData = CREATEOBJECT("fwCursor", "aCursor")
aString = fwJSON.Write(JSONResponse)
In any case, the output from above is what I need but without the rows and count properties.
Unfortunately,the ExcludedProperties would not work in my situation and being new to JSON, I'm having a hard time figuring this out.
Sent by FoxWeb Support on 10/10/2012 06:11:54 PM:
Are you sure you are using fwJSON.Write? The fwJSON.WriteCursor method adds a Rows and Count properties, but the Write method only outputs existing properties of the objects being serialized (minus the default VFP properties listed in the documentation).
The documentation for ExcludedProperties seems clear enough to me:
property contains a comma-separated list of object properties that are omitted from JSON strings, produced by the Write
method. If the object being serialized is based on the VFP's Custom class, then the following properties are omitted by default, so there is no need to include them in ExcludedProperties
: Application, BaseClass, Class, ClassLibrary, Comment, ControlCount, Controls, Height, HelpContextId, Left, Name, Objects, Parent, ParentClass, Picture, Tag, Top, WhatsThisHelpId, Width. This property is read/write.
Let's say for example that you were serializing an object containing Rows and Count properties. If you wanted to omit these from the JSON string, you would use the following:
fwJSON.ExcludedProperties = "rows,count"
M.JsonString = fwJSON.Write(M.MyObject)
Note that ExcludedProperties does not affect the WriteCursor method.
FoxWeb Support Team
Sent by irace_z28 on 10/10/2012 05:02:00 PM:
I have a JSON string that throws in the properties "count" and "rows" by default using the jwJSON.Write method.
How do I remove those properties?
I looked at the "ExcludedProperties" but the description didn't help and there are no examples.