# CLJS/JS interop re: nested JS

**URL:** https://clojureverse.org/t/cljs-js-interop-re-nested-js/10367
**Category:** General Questions
**Created:** [October 14, 2023, 8:51pm UTC](https://clojureverse.org/t/cljs-js-interop-re-nested-js/10367 "2023-10-14T20:51:34Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Webdev\_Tory](https://clojureverse.org/user_avatar/clojureverse.org/webdev_tory/32/3781_2.png) [@Webdev\_Tory](https://clojureverse.org/u/Webdev_Tory)
#### Post date: [October 14, 2023, 8:51pm UTC](https://clojureverse.org/t/cljs-js-interop-re-nested-js/10367/1 "2023-10-14T20:51:35Z")

</div>

This past week I had a lot of bad time involving trying to use a 3rd-party Javascript API. The last problem I had took a lot of lost time before I realized that my #js call was NOT recursive, when the API needed a map like the following:

```js
const login = async () => {
  await auth0Client.loginWithRedirect({
    authorizationParams: {
      redirect_uri: window.location.origin
    }
  });
};

```

My problem had come when I translated it as so:

```clojure
#js {"authorizationParams" {"redirect_uri" (-> js/window .-location .-origin)}

```

Eventually, as is sometimes the case when writing in a transpiled language, I disregarded the cluelessly misleading log errors and realized I just needed to add a second #js to go with the second (nested) map. So, now my question: does anyone have recommendations when dealing with JS apis, particularly ones wanting nested data? I am looking at CLJS Bean from the esteemed Mike Fikes, [https://github.com/mfikes/cljs-bean](https://github.com/mfikes/cljs-bean) , but are there other recommendations or supporting comments?

---

<div class="post-metadata">

### Author: ![Webdev\_Tory](https://clojureverse.org/user_avatar/clojureverse.org/webdev_tory/32/3781_2.png) [@Webdev\_Tory](https://clojureverse.org/u/Webdev_Tory)
#### Post date: [October 14, 2023, 9:26pm UTC](https://clojureverse.org/t/cljs-js-interop-re-nested-js/10367/2 "2023-10-14T21:26:52Z")

</div>

oh, good gracious. This is built in with the `clj->js` function. [clj-\>js](https://cljs.github.io/api/cljs.core/clj-GTjs)

---

<div class="post-metadata">

### Author: ![dave.liepmann](https://clojureverse.org/user_avatar/clojureverse.org/dave.liepmann/32/5211_2.png) [@dave.liepmann](https://clojureverse.org/u/dave.liepmann)
#### Post date: [October 15, 2023, 11:18am UTC](https://clojureverse.org/t/cljs-js-interop-re-nested-js/10367/3 "2023-10-15T11:18:42Z")

</div>

You might be interested in `j/lit` and `j/obj` from [GitHub - applied-science/js-interop: A JavaScript-interop library for ClojureScript.](https://github.com/applied-science/js-interop#objectarray-creation)

---

<div class="post-metadata">

### Author: ![system](https://clojureverse.org/uploads/default/original/2X/5/51079bf9e4b7d9466242c06cf1e43b9f8bd6da14.png) [@system](https://clojureverse.org/u/system)
#### Post date: [April 14, 2024, 11:19pm UTC](https://clojureverse.org/t/cljs-js-interop-re-nested-js/10367/4 "2024-04-14T23:19:34Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
