Open Side Menu Go to the Top
Register
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

02-05-2019 , 01:24 PM
Object makes sense if you want to pluck out one record by ID.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-05-2019 , 02:08 PM
That json seems perfectly fine.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-05-2019 , 02:10 PM
Didn't think about it that way.

This is the proposed json from another team, I have to loop through all the entries so it's going to be easier if it's an array. It may be consumed by someone else so that may be why they did it that way. I'm trying to decide if it's worth pushing back to get it in an array.

Last edited by blacklab; 02-05-2019 at 02:21 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-05-2019 , 04:09 PM
How big can this JSON get? Is performance an issue?

Do you need the array in some kind of order as you loop?

If neither is an issue you can just do Object.values(Entries) and avoid having a pushback squabble.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-05-2019 , 05:18 PM
that json makes no sense. why is ID in there twice? and it should def be an array.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-05-2019 , 05:41 PM
Quote:
Originally Posted by blacklab
Is it just me being anal or is this ok for json?

Code:
{
	"Entries": {
		"001006360": {
			"ID": "001006360",
			"Tier": "2",
			"Summary": [{
				"text": "some content",
				"textType": {
					"description": "stuff",
					"Code": 32466
				}
                         }]
		},
		"001008697": {
			"ID": "001008697",l
			"Tier": "2",
			"Summary": [{
				"text": "some content",
				"textType": {
					"description": "stuff",
					"Code": 32456
				}
			}]
		}
	},
	"RecordCount": 2
}
Fixed it for you.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-05-2019 , 05:49 PM
Why does Entries/RecordCount exist? Unless you're only returning a subset you can count how many entries there are easy enough.

I don't really understand why summary is an array of hashes. But then again I don't really know what the textType field is about, so presumably that makes more sense if you know what Summary actually is

I can't tell what adios changed
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-05-2019 , 06:14 PM
Quote:
Originally Posted by Victor
that json makes no sense. why is ID in there twice? and it should def be an array.
I see that a lot. So you can pluck an object by ID. But then you still have the ID if you pass the object around.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-05-2019 , 06:19 PM
You guys must be living right if you that's a weird API response for you. It seems like most of my last job was wrangling much weirder API responses than that. And there was never a chance to push back.

There was one time that we had to point out to the team that handled out entertainment catalog (movie/tv shows) that their filters (rating, genre, number of stars, etc.) counts were completely wrong in a multi-select world. The original API only allowed single select, they changed it to multi-select but didn't update the count logic - which gets really gnarly with a multi-select (zappos is the only site we could find online which actually does it right).

Anyway we met with the team, they listened and understood -- with the help of Zappos as a visual aid. They told us they'd try to get it into the SDLC - minimum time a year before it gets worked on. Which basically meant we'd have to keep pestering them every quarter or it was never gonna happen.

Corporate fun.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-05-2019 , 06:42 PM
Quote:
Originally Posted by RustyBrooks
Why does Entries/RecordCount exist? Unless you're only returning a subset you can count how many entries there are easy enough.

I don't really understand why summary is an array of hashes. But then again I don't really know what the textType field is about, so presumably that makes more sense if you know what Summary actually is

I can't tell what adios changed
Was

Code:
{
	"Entries": {
		"001006360": {
			"ID": "001006360",
			"Tier": "2",
			"Summary": [{
				"text": "some content",
				"textType": {
					"description": "stuff",
					"Code": 32466
				}]
		},
Changed to:

Code:
{
	"Entries": {
		"001006360": {
			"ID": "001006360",
			"Tier": "2",
			"Summary": [{
				"text": "some content",
				"textType": {
					"description": "stuff",
					"Code": 32466
				}
                         }]
		},
There are sites where you can submit JSON formatted data that will do validity checks. Have been working with JSON a fair amount lately.

Last edited by adios; 02-05-2019 at 06:48 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-05-2019 , 07:04 PM
I'm not going back a page, but I think adios put the ",1" on one of the IDs and I think breaks it.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-05-2019 , 07:06 PM
So adios broke the JSON then said fixed it for you?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-05-2019 , 07:12 PM
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-05-2019 , 07:13 PM
Quote:
Originally Posted by suzzer99
So adios broke the JSON then said fixed it for you?
He also added a missing brace, so, six of one...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-06-2019 , 12:03 AM
God, that comparison of those JSON snippets gave me horrible flashbacks to some database class I took that gave us horrible problems on our final of trying to "find the error" in different JSON objects and they all looked completely identical. Could stare at them for an hour and not see the difference between 4 options, let alone narrow down the oddball.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-06-2019 , 12:09 AM
You weren't allowed to plug them into JSON lint? Because staring at JSON for errors is literally something no sane human would ever do, and grounds for a torture complaint imo.

YAML FOR LIFE!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-06-2019 , 12:12 AM
No it was a paper test.

The worst part was they were clearly the “gimme” problems that were impossible to miss if you carefully went character by character to find the error. It just was really hard to see. So i spent about an hour on those problems and 10 mins on the rest of the test because i was just guessing on the rest and knew i could eventually get these.

Figures i now work on a noSQL db, it was by far my worst subject.

Lol looking back at my CS education and it feels so worthless. I went to a good school too.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-06-2019 , 12:28 AM
We've had the argument ITT I think but CS degrees are probably 80% worthless imo.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-06-2019 , 12:31 AM
I used to think they werent, in the last year i’ve changed my mind to 95% worthless.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-06-2019 , 12:35 AM
Quote:
Originally Posted by ChrisV
We've had the argument ITT I think but CS degrees are probably 80% worthless imo.
FWIW I think this is true for a large majority of careers. Will be interested to see where higher education is in 20 years
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-06-2019 , 12:42 AM
Everything is worthless. College was fun at least.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-06-2019 , 12:43 AM
I don't so much think that "CS degrees are worthless" as I do that "CS degrees are more like math degrees (or maybe physics) than engineering"

It's a bit like giving a guy a degree in physics and then sending him out to build a bridge. He's got all the elements he needs, in a way, but he's not really prepared for the demands of the job, and he knows a lot of stuff that isn't really going to be useful in this case, but was hard to learn.

My college offered degrees in "software engineering" but as far as I can tell they were complete bull****. I have seen degrees in "computer engineering" but I *think* they might have been more about designing computer hardware.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-06-2019 , 12:45 AM
Back in my day at my school anyway CS tagged along with electrical engineering. EECS.

Not my major though.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-06-2019 , 12:49 AM
yeah, I accidentally removed a bracket when shortening it up for easy consumption.

I've been parsing json for a while and had never seen something like that where there was data in a key name rather than a key. Just seemed wrong and with 40,000 items in the json it adds 40,000 rows of data, just seems like a waste.

Speed or size really shouldn't be an issue as this will just run once a week. I politely asked if we can change it, but no big deal if they don't.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
02-06-2019 , 12:50 AM
I had a phone interview yesterday (still probably going full time with the university, but this job ticks all the boxes). I knew b-tree was probably coming because the recruiter said so. Didn't even bother trying to study and regurgitate some crap.

After a couple of pretty decent real-world thought problems, the interviewer said "ok, now going back to your computer science days". I said "I have a degree in physics". He laughed, but asked anyway. I said all I've never had to use one, all know is it looks like a multi-level-marketing hierarchy, and it's the best way to find something in a sorted list. He seemed happy enough.

I have a "coding challenge" next week. Really dude - you're hiring a super senior person to lead a team and still calling it a coding challenge? Yay.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m