# How to pass a Variant through Candid

**URL:** <https://forum.dfinity.org/t/how-to-pass-a-variant-through-candid/5909>\
**Category:** Developers\
**Created:** [July 15, 2021, 12:56am UTC](https://forum.dfinity.org/t/how-to-pass-a-variant-through-candid/5909 "2021-07-15T00:56:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasonyeoh](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@jasonyeoh](https://forum.dfinity.org/u/jasonyeoh)\
**Post date:** [July 15, 2021, 12:56am UTC](https://forum.dfinity.org/t/how-to-pass-a-variant-through-candid/5909/1 "2021-07-15T00:56:36Z")

</div>

I have a variant nested within a record type

```
public type MyVariantType = {
    #type1;
    #type2;
};
public type MyRecord = {
    id: Nat;
    recordtype: MyVariantType;
};

```

In my public actor function I share an interface to pass in a vector of records, so:

```
public func pass_records (in_records : [MyRecord]) : async () {
    // do something
};

```

What object notation do I call the actor with in Javascript? I have tried the following.

`[{"id":1, "recordtype": {"type1": true}}]`  
`[{"id":1, "recordtype": {"type1": null}}]`  
`[{"id":1, "recordtype": {"type1": {} }}]`  
`[{"id":1, "recordtype": {"type1": true, "type2": false}}]`

The first strategy seems to work when variants have some value to go with it.

---

<div class="post-metadata">

**Author:** ![chenyan](https://avatars.discourse-cdn.com/v4/letter/c/35a633/32.png) [@chenyan](https://forum.dfinity.org/u/chenyan)\
**Post date:** [July 15, 2021, 1:18am UTC](https://forum.dfinity.org/t/how-to-pass-a-variant-through-candid/5909/2 "2021-07-15T01:18:37Z")

</div>

The second one should work: `[{"id":BigInt(1), "recordtype": {"type1": null}}]`. Note that Nat corresponds to `bigint` in JS

`#type1` corresponds to `{ type1: null }`; and `#type1: Nat` corresponds to `{ type1: BigInt(42) }`
