---
schema_version: "1"
id: 38118d019fe987e5ad94330740539cfa0e9077c6c89be4d04f6dbd62223f8798
title: keySet
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.3/dw-objects-functions-keyset.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.3/dw-objects-functions-keyset
source_site: docs.mulesoft.com
content_type: documentation
content_hash: afda5774764d1cf6cb486e47fe3ef243eaf32c1bf44a643fddd308c6c8ff9174
description: MuleSoft Documentation Site
release: "2.3"
latest: false
---
# keySet

## [](#keyset1)keySet(T): ?

オブジェクトからのキー名の配列を返します。

このメソッドは​**非推奨**​です。代わりに、Core モジュールの ​`keysOf`​ を使用してください。

### [](#パラメーター)パラメーター

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 75%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock">​<code>object</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">評価するオブジェクト。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、入力オブジェクトからのキーを返します。

#### [](#ソース)ソース

```DataWeave
%dw 2.0
import * from dw::core::Objects
output application/json
---
{ "keySet" : keySet({ "a" : true, "b" : 1}) }
```

#### [](#出力)出力

```JSON
{ "keySet" : ["a","b"] }
```

### [](#例-2)例

次の例は、​`keySet`​ と ​`nameSet`​ の違いを示しています。 `keySet`​ は XML 入力からの属性 (​`name`​ と ​`lastName`​) と名前空間 (​`xmlns`​) を保持していますが、​`nameSet`​ はそれらを保持しないため、​`null`​ を返しています。

#### [](#ソース-2)ソース

```DataWeave
%dw 2.0
import * from dw::core::Objects
var myVar = read('<users xmlns="http://test.com">
                     <user name="Mariano" lastName="Achaval"/>
                     <user name="Stacey" lastName="Duke"/>
                  </users>', 'application/xml')
output application/json
---
{ keySetExample: flatten([keySet(myVar.users) map $.#,
                          keySet(myVar.users) map $.@])
}
++
{ nameSet: flatten([nameSet(myVar.users) map $.#,
                    nameSet(myVar.users) map $.@])
}
```

#### [](#出力-2)出力

```JSON
{
  "keySet": [
    "http://test.com",
    "http://test.com",
    {
      "name": "Mariano",
      "lastName": "Achaval"
    },
    {
      "name": "Stacey",
      "lastName": "Duke"
    }
  ],
  "nameSet": [
    null,
    null,
    null,
    null
  ]
}
```