Malformed JSON string while retrieving Crucible review data using REST Api's

Hello ,

The following code snippet throws the following error :

my $headers = {Content-type => 'application/json' ,Accept => 'application/json', Authorization => 'Basic ' . encode_base64($username . ':' . $password)};

my $client = REST::Client->new();



#print $client->responseContent();

my $response = from_json($client->responseContent());

print $response;

malformed JSON string, neither array, object, number, string or atom, at charact

er offset 1 (before "<!DOCTYPE html>\n<ht...") at line

Any suggestion's?

Thanks ,


4 answers

0 vote

It looks like you are getting an error response. Can you look at the whole response. Usually there is a message in there regarding the error. You can alos look at the log on the server side to see what might be going wrong.

That's not a JSON response, by the way.

Hi Mohan,

Are you using your REST client correctly? I'm not super familiar with perl, but I would assume that a method called setHost is not meant to take a URL path. You could try something like this:



You may also need to set the port separately to the host?


Hi Sergey ,

how do i need to ensure that i get a JSON response ?

Suggest an answer

Log in or Join to answer
Community showcase
Alexey Matveev
Published Saturday in Jira

How to run Jira in a docker container

Everything below is tested on Ubuntu 17.10. I prefer to use Jira in a docker container because: 1. I can install Jira with a couple of commands. 2. I can start and stop Jira just by starting and s...

405 views 6 8
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot