Skip to content

Commit fb9bd93

Browse files
Merge pull request #227269 from yoelhor/patch-329
[Azure AD B2C] GetClaimsFromJsonArrayV2 CT
2 parents 421f54d + 913728e commit fb9bd93

File tree

1 file changed

+99
-1
lines changed

1 file changed

+99
-1
lines changed

articles/active-directory-b2c/json-transformations.md

Lines changed: 99 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ manager: CelesteDG
99
ms.service: active-directory
1010
ms.workload: identity
1111
ms.topic: reference
12-
ms.date: 09/07/2022
12+
ms.date: 02/14/2023
1313
ms.author: kengaderdus
1414
ms.subservice: B2C
1515
---
@@ -409,6 +409,104 @@ In the following example, the claims transformation extracts the following claim
409409
- **active**: true
410410
- **birthDate**: 2005-09-23T00:00:00Z
411411

412+
413+
## GetClaimsFromJsonArrayV2
414+
415+
Get a list of specified elements from a string collection JSON elements. Check out the [Live demo](https://github.com/azure-ad-b2c/unit-tests/tree/main/claims-transformation/json#getclaimsfromjsonarrayv2) of this claims transformation.
416+
417+
| Element | TransformationClaimType | Data Type | Notes |
418+
| ---- | ----------------------- | --------- | ----- |
419+
| InputClaim | jsonSourceClaim | stringCollection | The string collection claim with the JSON payloads. This claim is used by the claims transformation to get the claims. |
420+
| InputParameter | errorOnMissingClaims | boolean | Specifies whether to throw an error if one of the claims is missing. |
421+
| InputParameter | includeEmptyClaims | string | Specify whether to include empty claims. |
422+
| InputParameter | jsonSourceKeyName | string | Element key name |
423+
| InputParameter | jsonSourceValueName | string | Element value name |
424+
| OutputClaim | Collection | string, int, boolean, and datetime |List of claims to extract. The name of the claim should be equal to the one specified in _jsonSourceClaim_ input claim. |
425+
426+
### Example of GetClaimsFromJsonArrayV2
427+
428+
In the following example, the claims transformation extracts the following claims: email (string), displayName (string), membershipNum (int), active (boolean) and birthDate (datetime) from the JSON data.
429+
430+
```xml
431+
<ClaimsTransformation Id="GetClaimsFromJson" TransformationMethod="GetClaimsFromJsonArrayV2">
432+
<InputClaims>
433+
<InputClaim ClaimTypeReferenceId="jsonSourceClaim" TransformationClaimType="jsonSource" />
434+
</InputClaims>
435+
<InputParameters>
436+
<InputParameter Id="errorOnMissingClaims" DataType="boolean" Value="false" />
437+
<InputParameter Id="includeEmptyClaims" DataType="boolean" Value="false" />
438+
<InputParameter Id="jsonSourceKeyName" DataType="string" Value="key" />
439+
<InputParameter Id="jsonSourceValueName" DataType="string" Value="value" />
440+
</InputParameters>
441+
<OutputClaims>
442+
<OutputClaim ClaimTypeReferenceId="email" />
443+
<OutputClaim ClaimTypeReferenceId="displayName" />
444+
<OutputClaim ClaimTypeReferenceId="membershipID" />
445+
<OutputClaim ClaimTypeReferenceId="active" />
446+
<OutputClaim ClaimTypeReferenceId="birthDate" />
447+
</OutputClaims>
448+
</ClaimsTransformation>
449+
```
450+
451+
- Input claims:
452+
- **jsonSourceClaim[0]** (string collection first element):
453+
454+
```json
455+
{
456+
"key": "email",
457+
"value": "[email protected]"
458+
}
459+
```
460+
461+
- **jsonSourceClaim[1]** (string collection second element):
462+
463+
```json
464+
{
465+
"key": "displayName",
466+
"value": "Someone"
467+
}
468+
```
469+
470+
- **jsonSourceClaim[2]** (string collection third element):
471+
472+
```json
473+
{
474+
"key": "membershipID",
475+
"value": 6353399
476+
}
477+
```
478+
479+
- **jsonSourceClaim[3]** (string collection fourth element):
480+
481+
```json
482+
{
483+
"key": "active",
484+
"value": true
485+
}
486+
```
487+
488+
- **jsonSourceClaim[4]** (string collection fifth element):
489+
490+
```json
491+
{
492+
"key": "birthDate",
493+
"value": "2005-09-23T00:00:00Z"
494+
}
495+
```
496+
497+
- Input parameters:
498+
- **errorOnMissingClaims**: false
499+
- **includeEmptyClaims**: false
500+
- **jsonSourceKeyName**: key
501+
- **jsonSourceValueName**: value
502+
- Output claims:
503+
- **email**: "[email protected]"
504+
- **displayName**: "Someone"
505+
- **membershipID**: 6353399
506+
- **active**: true
507+
- **birthDate**: 2005-09-23T00:00:00Z
508+
509+
412510
## GetNumericClaimFromJson
413511

414512
Gets a specified numeric (long) element from a JSON data. Check out the [Live demo](https://github.com/azure-ad-b2c/unit-tests/tree/main/claims-transformation/json#getnumericclaimfromjson) of this claims transformation.

0 commit comments

Comments
 (0)