InvalidJSON. The 'content' property of actions of type 'ParseJson' must be valid JSON. The provided value

ukerandi
ukerandi used Ask the Experts™
on
Hi experts,
I have following issue when i'm doing sharepoint 365 live  HTTP . I used parse Jason  in the work flow.
Any idea how to do that much appriciated

See below error message

InvalidJSON. The 'content' property of actions of type 'ParseJson' must be valid JSON. The provided value '<?xml version="1.0"?> <directory> <fieldset> <field id="displayName">Display name</field> <field id="firstName">First name</field> <field id="lastName">Last name</field> <field id="preferredName">Preferred name</field> <field id="gender">Gender</field> <field id="jobTitle">Job title</field> <field id="workPhone">Work Phone</field> <field id="workEmail">Work Email</field> <field id="department">Department</field> <field id="location">Location</field> <field id="division">Division</field> <field id="workPhoneExtension">Work Ext.</field> <field id="photoUploaded">Employee photo</field> <field id="photoUrl">Photo URL</field> <field id="canUploadPhoto">Can Upload Photo</field> </fieldset> <employees> <employee id="440"> <field id="displayName">Brendan Adams</field> <field id="firstName">Brendan</field> <field id="lastName">Adams</field> <field id="preferredName">Brendan</field> <field id="gender">Male</field> <field id="jobTitle">Production Supervisor</field> <field id="workPhone"></field>

When i'm trying to Postman  API out put looks like this

<?xml version="1.0"?>
<directory>
    <fieldset>
        <field id="displayName">Display name</field>
        <field id="firstName">First name</field>
        <field id="lastName">Last name</field>
        <field id="preferredName">Preferred name</field>
        <field id="gender">Gender</field>
        <field id="jobTitle">Job title</field>
        <field id="workPhone">Work Phone</field>
        <field id="workEmail">Work Email</field>
        <field id="department">Department</field>
        <field id="location">Location</field>
        <field id="division">Division</field>
        <field id="workPhoneExtension">Work Ext.</field>
        <field id="photoUploaded">Employee photo</field>
        <field id="photoUrl">Photo URL</field>
        <field id="canUploadPhoto">Can Upload Photo</field>
    </fieldset>
    <employees>
        <employee id="440">
            <field id="displayName">dsds</field>
            <field id="firstName">dsds</field>
            <field id="lastName">dsd</field>
            <field id="preferredName">dsds</field>
            <field id="gender">dsd</field>
            <field id="jobTitle">dsd</field>
            <field id="workPhone"></field>
            <field id="workEmail">dsds</field>
            <field id="department">dsds</field>
            <field id="location">dsd</field>
            <field id="division">dsds</field>
            <field id="workPhoneExtension"></field>
            <field id="photoUploaded">true</field>
            <field id="photoUrl"></field>
            <field id="canUploadPhoto">no</field>
        </employee>
   </employee>
    </employees>
</directory>
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
ste5anSenior Developer

Commented:
Well, the output is obviously XML. Whereas your consumer requires JSON. They are completely different data formats.

Look into your service invocation call. Does the used API allow different output formats?

If it's a RESTful web service, you should be able to control it by the Content-Type header. Here the common values are "application/json" or "application/xml". Sometimes also "text/json" or "text/xml".

EDIT: Mean Accept header instead of Content-Type..

Author

Commented:
Thank you very much for reply

ok. i managed to start work. only i have changed to
Accept : application/json
Format : JSON

and leave the Content-Type-application/json.

Any specific reason not work only with Content-Type: application/json
Senior Developer
Commented:
ah, meant indeed the Accept header, not the content type header. Accept defines what format you want, whereas Content-Type declares the format of the following data (content) in the current request.

I don't know, depends on you and what you do with that API..

Author

Commented:
Thanks anyway

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial