我调用了返回的 REST API:
{
"a": false,
"b": 1,
"student": {
"person": {
"name": "Complete name here"
...
}
}
}
这样......我需要从学生中提取 person.name 到 B2C 中的声明,但目前,只能以下面的这种格式获取学生
"student": "{\r\n \"studyShiftId\": 4,\r\n \"academicActive\": true,\r\n \"active\": true,\r\n \"person\": {\r\n \"documentCode\": \"041.407.671-03\",\r\n \"name\": \"LEONARDO SOARES DOS SANTOS\",\r\n },\r\n \"course\": [\r\n {\r\n \"name\": \"Direito - Bacharelado\",\r\n \"type\": \"Presencial\",\r\n \"enrollmentCode\": \"3699342283\",\r\n \"alucod\": \"3699342\",\r\n \"academicStateCode\": \"P\",\r\n \"academicStateName\": \"Período de Matrícula\",\r\n \"campus\": {\r\n \"name\": \"UNICEN PRIMAVERA - UNIDADE NOVA\",\r\n \"brand\": {\r\n \"name\": \"Unic\",\r\n \"urlImg\": \"https://stportaldoalunotst.blob.core.windows.net/unic.png\",\r\n \"color\": \"#005397\"\r\n }\r\n }\r\n }\r\n ]\r\n}"
<ClaimType Id="student">
<DataType>string</DataType>
</ClaimType>
我已经尝试过使用GetClaimFromJson / Microsoft Docs并引发了一个致命异常
声明转换:
<ClaimsTransformation Id="GetPersonalDataFromJson" TransformationMethod="GetClaimFromJson">
<InputClaims>
<InputClaim ClaimTypeReferenceId="student" TransformationClaimType="inputJson" />
</InputClaims>
<InputParameters>
<InputParameter Id="claimToExtract" DataType="string" Value="person" />
</InputParameters>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="extension_person" TransformationClaimType="extractedClaim" />
</OutputClaims>
</ClaimsTransformation>
<ClaimsTransformation Id="GetEmailFromPersonalData" TransformationMethod="GetClaimFromJson">
<InputClaims>
<InputClaim ClaimTypeReferenceId="extension_person" TransformationClaimType="inputJson" />
</InputClaims>
<InputParameters>
<InputParameter Id="claimToExtract" DataType="string" Value="email" />
</InputParameters>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="email" TransformationClaimType="extractedClaim" />
</OutputClaims>
</ClaimsTransformation>
简而言之:从 JSON 数据中提取子元素内的声明,路径例如:student.person.name
感谢任何帮助。