Owners API Doesn't Return Valid JSON if Email Signature Has a Link Within It


#1

I'm struggling with traversing the JSON I get when using the Owners API Endpoint. https://api.hubapi.com/owners/v2/owners?

Many of the users/owners at our company have placed links into their signatures. Those attributes inside those links are being surrounded by unescaped double quotes at the endpoint and that leaves me without valid JSON.

Damn you Hubspot! Escape your attributes!
I kid. I kid. Surely there is an easy way around this and I'm too much of an idiot to realize what it is. Hubspot is a pretty well capitalized company and I doubt that kind of error would make it past the alpha phase.

Anyone ever run into this before? I am at a bit of a loss right now as to how to proceed. I'm just copying the data to a file and running a search and replace for the whole signature line, but that more or less defeats the point of what I am doing.

I cannot seem to find this problem in the forum, but it has to be there somewhere and I am missing it.
I'm not new to Javascript, but I'm dead in the middle of the "conscious incompetence" period -- which is a long way from mastery. Surely one of you chaps has seen this problem before and can point me in the right direction?


#2

Hi @nickmortensen,

I'm not able to reproduce this on my end; I'm seeing quotations in owner signatures being escaped properly. Can you give me the Hub ID of the portal you're seeing this in so that I can take a closer look?


#3

Wrapping the output in a JSON.stringify made the problem moot, but it is still worth looking at if you are actively developing your API -- I'm sure 99% of the people working with your API are Javascript Black Belts, but I'm just sort of fumbling my way through and JSON.stringify() wasn't entirely new to me, but I still didn't see it as the obvious solution.

I'd imagine my issue is something of an edge case:
We don't have a ton of tech savvy sales staff around here, so it seems that they had been just copying and pasting their signatures from gmail. This lead to me ending up with something like this (names changed for privacy)

"signature": "<div> </div><div><strong>Sales Person</strong> | Senior Sales Consultant<br/><strong>Any Co </strong><br/><strong>Tagline</strong><br/>Direct: 900-925-90210 | Cell: 920-360-2000<br/>City, ST<br/><a href="http://www.companylink.com/">www.comapnylink.com</a></div><div>See our unique capabilities in these videos</div><div><a href="https://www.youtube.com/embed/YouTube Link">Manufacturing Magificence</a></div><div><a href="https://www.youtube.com/embed/YouTube Link">Aluminum Awesomeness</a></div>",

Note the href attributes in the above signature are non-escaped double quotes and those will render the JSON invalid unless the data output is wrapped in a JSON.stringify().


#4

Hi @nickmortensen,

I can totally see what you mean; I want to be able to dig into a specific example of this, but I'm not currently able to reproduce this behavior in my own portal. Do you have the Hub ID of a portal where the user's signatures are behaving like this?


#5

You mean, the one I am using? Is that something that is OK to share in a forum or would you have me send it via a private message.


#6

Hi @nickmortensen,

It's not a particularly sensitive piece of information; you can post it here, but feel free to send it to me in a DM if you'd prefer.