# Javascript SDK returns json with camelCase keys while Platform API returns snake\_case

**URL:** <https://community.sendbird.com/t/javascript-sdk-returns-json-with-camelcase-keys-while-platform-api-returns-snake-case/3828>\
**Category:** JavaScript\
**Tags:** group-channel, chatsdk\
**Created:** [January 21, 2022, 7:51pm UTC](https://community.sendbird.com/t/javascript-sdk-returns-json-with-camelcase-keys-while-platform-api-returns-snake-case/3828 "2022-01-21T19:51:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![quarryman](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/quarryman/32/1180_2.png) [@quarryman](https://community.sendbird.com/u/quarryman)\
**Post date:** [January 21, 2022, 7:51pm UTC](https://community.sendbird.com/t/javascript-sdk-returns-json-with-camelcase-keys-while-platform-api-returns-snake-case/3828/1 "2022-01-21T19:51:38Z")

</div>

Hi guys.  
I’ve been using js-sdk for quiet long now and recently I started retrieving the same data with platform API.  
As example I am retrieving users channel list.  
The issue is that Platform API response is totally different due to snake\_case keys and its not easy to consume data from it.

Can someone explain why SDK and Platform have differences in response scheme and how does SDK transform json (caz its retrieved from REST in snake\_case but resulting JSON is not) to camelCase so that maybe its possible to get this adapter from sources at least?

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [January 21, 2022, 8:00pm UTC](https://community.sendbird.com/t/javascript-sdk-returns-json-with-camelcase-keys-while-platform-api-returns-snake-case/3828/2 "2022-01-21T20:00:58Z")

</div>

Hello @quarryman,

When the SDK receives data, it formats the JSON in a way that is inline with Javascript standards, thus the camelCase.

As our backend API service is built in python, the Platform API returns items in snack\_case as it’s inline with Python standards.

---

<div class="post-metadata">

**Author:** ![quarryman](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/quarryman/32/1180_2.png) [@quarryman](https://community.sendbird.com/u/quarryman)\
**Post date:** [January 21, 2022, 8:05pm UTC](https://community.sendbird.com/t/javascript-sdk-returns-json-with-camelcase-keys-while-platform-api-returns-snake-case/3828/3 "2022-01-21T20:05:05Z")

</div>

Hi @Tyler  
I see the reason, thanx for clarification.

However its not possible for single client to consume data from both APIs having different schemas.  
In our case we retrieve some data from Endpoint that utilizes platform API and get another response scheme.

Is it possible to somehow get SDK adapter that formats JSON as we dont know exactly what is changed after formating is applied?

Or advice another approach how to format data coming from Platform API to the same format as SDK please

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [January 21, 2022, 8:40pm UTC](https://community.sendbird.com/t/javascript-sdk-returns-json-with-camelcase-keys-while-platform-api-returns-snake-case/3828/4 "2022-01-21T20:40:51Z")

</div>

I’m not sure I follow. Can you provide me an example where the schema differs? The same data is returned in both the Platform API and the Object in the JS SDK.

As a note, we don’t recommend using the Platform API in your client application (outside of the calls the SDK makes) as you risk exposing your Api-Token.

---

<div class="post-metadata">

**Author:** ![quarryman](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/quarryman/32/1180_2.png) [@quarryman](https://community.sendbird.com/u/quarryman)\
**Post date:** [January 21, 2022, 9:51pm UTC](https://community.sendbird.com/t/javascript-sdk-returns-json-with-camelcase-keys-while-platform-api-returns-snake-case/3828/5 "2022-01-21T21:51:19Z")

</div>

@Tyler  
Given we have frontend app that retrieves user’s channel list using SDK and processes channels in particular manner and then it retrieves the same channels list using our API endpoint that uses Platform API which proxies it back to frontend transparently, we are not able to process Platform API response as it has snake\_case keys which means it has different scheme/types then SDK response.

Processing logic expects to get channel List with CamelCase keys and we get snake\_case response, which is not processable within single frontend app.

We dont use platform API in client, we just proxy it through backend API

I was asking for a way to get Platform API response in snake\_case and transform it to camelCase (exactly what you told SDK does) so that frontend client can work with both responses.

> The same data is returned in both the Platform API and the Object in the JS SDK.  
> As much as I see its not correct. Platform API json response keys are snake\_case and SDK data is CamelCased json, which are very different

Just to clarify.  
SDK json

```auto
{
  ...
 createdAt: 1642784303000
 }

```

Platform json for the same channel

```auto
"created_at": 1642784303000,

```

When I say SDK response I mean data that we get in callback/promise of SDK invocation and we can work with. Under the hood SDK retrieves the same snake\_case json, but as you told its transformed and we dont have control neither to this transformation nor to pure data before transformation

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [January 21, 2022, 10:13pm UTC](https://community.sendbird.com/t/javascript-sdk-returns-json-with-camelcase-keys-while-platform-api-returns-snake-case/3828/6 "2022-01-21T22:13:08Z")

</div>

Hey @quarryman,

There is no way for us to provide you with a method or interface to convert from snake\_case to camelCase. You would need to create your own method on the backend to convert the snake\_case to camelCase.

---

<div class="post-metadata">

**Author:** ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)\
**Post date:** [January 21, 2022, 11:54pm UTC](https://community.sendbird.com/t/javascript-sdk-returns-json-with-camelcase-keys-while-platform-api-returns-snake-case/3828/7 "2022-01-21T23:54:47Z")

</div>

Closed on January 21, 2022, 11:54pm UTC


