Showing posts with label JSON. Show all posts
Showing posts with label JSON. Show all posts

Tuesday 25 February 2014

ColdFusion 11: query column types preserved when serialising to JSON, eh?

G'day:
I'm playing catch-up with the comments on the blog, and one of said comments from Roberto Marzialetti got me looking at an old article: "ColdFusion vs JSON. How to make a developer cry". In this article I mooted an alteration to how ColdFusion serialises query data so as to preserve the column types. This is critical with queries because CFML operations on this data such as QoQ is type-sensitive. So we need the data type.

Tuesday 6 August 2013

ColdFusion & JSON: yet another bug

G'day:
This might actually be a manifestation of the same issue I wrote about a while back: "Right... so JSON is being a pain in the arse again". And I didn't spot this one myself - I've given up on using JSON in ColdFusion as it's just too unstable - but read about it on a thread on CF-TALK (it's not in the archive yet, so I cannae link to it).

Anyway, this time the issue is with ColdFusion and "strings that look like numbers" again, but a different slant on it. Consider this code:

number = .0006;
struct = {number=number};
json = serializeJSON(struct);
writeDump([
    {number=number},
    {"struct.number"=struct.number},
    {struct=struct},
    {json=json}
]);

On ColdFusion (9, and apparently 10 too, going from the thread I can't link you to...), the output is this:

array
1
struct
NUMBER.0006
2
struct
struct.number.0006
3
struct
STRUCT
struct
NUMBER.0006
4
struct
JSON{"NUMBER":6.0E-4}

Nice. Thanks for that, ColdFusion. Just in case yer really going "wah??" there, that's scientific notation for 0.0006. So, ColdFusion... which part of "turn this into JSON" did you interpret as "turn this into JSON and any numbers with more then three decimal place? Scientific notation please". Just to demonstrate that this is not "just one of those things", here's the output in Railo:

Wednesday 17 July 2013

Another day, another ColdFusion JSON bug (and a Railo bug too, just not with JSON)

G'day:
Well at least this time it wasn't something that caught me out. This one wasted someone else's time.

Friday 12 July 2013

Yeah, so it wouldn't be my working week without another CF vs JSON issue

G'day:
Poor old me, and poor old Mockbox.

I just found this one when testing Mockbox 2.1. Testing it to see if we could upgrade to it (no, not until this is fixed). We already could not upgrade to 2.0 due to another issue (MOCKBOX-6), so on 1.3 we stay for the time being.

Both of these issues have been ColdFusion problems that Mockbox has been victim of though. Which sucks a bit for Luis & co.

Friday 5 July 2013

JSON: just to confirm my expectations aren't off

G'day:
I'm half-way across the Irish Sea at the moment (oh, now that I look out the window, I've actually just making landfall over Ireland), and sitting in a very cramped seat trying to write code on my netbook without elbowing the bloke next to me too much. So this will be short and to the point. And hopefully the last chapter in all this JSON nonsense.

Thursday 4 July 2013

Right... so JSON is being a pain in the arse again

G'day:
You might have seen my Twitter status update earlier today, which went kinda like this:

#ColdFusion.... JSON... AGAIN... AAAAAAAAAAAARRRRRRRRRRRRRGGGGGGGGGGGHHHHHHHH!!!!!!!

Tuesday 2 July 2013

There's always another bug...

G'day:
Whilst playing with objectSave() and objectLoad() yesterday, I came across yet another bug in ColdFusion. It really does seem sometimes that if one attempts to do anything other than the "obvious" in CF, there are bugs. Or illogical quirks. Or omissions in the implementation.

This is just a bug (NB: in ColdFusion 9.0.1+. But not Railo).

Serialisation woes resolved: "screw JSON"

G'day:
(third one today... the other two were only wee ones, so hardly count).

Right, so you might've read me wittering on about "ColdFusion vs JSON. How to make a developer cry". I needed to serialise some data to put it in a cache, and ColdFusion 9's JSON-handling is not up to the job.

What were were trying to do is to reliably serialise a query, and have ColdFusion not mess up either the null values, nor the dates (actually the latter is a side-effect of the JSON processing, and more an issue with query of query).

I was trying to use JSON because it was faster and lighter than WDDX, and it's kinda become the de facto way of doing quick serialisation, I think.

Yesterday I was forced to write this email to my superiors:

Friday 28 June 2013

ColdFusion vs JSON. How to make a developer cry

G'day:
In general on this blog, I've tried to steer clear of discussing what I'm currently doing at work, but I'm so pissed-off by all this, I have to share.

Wednesday 16 January 2013

Random (unsuccessful) experiment: recursive JSON

G'day:
This quick experiment arose from a comment on Twitter this morning:

@daccf @ntunney the worst part is that relationships don't get serialized either. Apparently recursion is too hard for them? 
(Todd Sharp ‏@cfsilence)
This was a reaction to a bug about serialising entities which was under discussion.

Tuesday 8 January 2013

Weird behaviour with CFHTTP and JSON

G'day:
Here's some useless information to file away wherever it is you file away such stuff.

I was code reviewing some of my colleague Dennis's (who has no online presence that I am aware of, so he doesn't get a link) work yesterday, and when processing an HTTP response, he had this sort of thing:

response = httpResponse.fileContent.toString();

My reaction was along the lines of "whoa there Nelly... it's just some JSON, so it's already intrinsically a string: we don't need to make it into a ReallyReallyString by toString()-ing it".

Well I'm glad I like being proven to be wrong, because that's what happened next.