Hey,
I have a problem with serializing json string into object.
I have a example class like
[DataContractAttribute]
public class MyObject
{
boolean myBool=true;
str description;
///
///
///
public void new()
{
}
[
DataMemberAttribute('myBool'),
AifCollectionTypeAttribute('myBool', Types::Integer),
AifCollectionTypeAttribute('return', Types::Integer)
]
public boolean parmMyBool(boolean _myBool = myBool)
{
myBool = _myBool;
return myBool;
}
[
DataMemberAttribute('description'),
AifCollectionTypeAttribute('description', Types::String),
AifCollectionTypeAttribute('return', Types::String)
]
public str parmDescription(str _description = description)
{
description = _description;
return description;
}
}
When i try to serialize
string like
"strjson": "{\"myBool\":false,\"description\":\"desc1234\"}"
the boolean value is not setting. Other hand when i change strjson into "strjson": "{\"myBool\":\"false\",\"description\":\"desc1234\"}" working totaly fine,
I digged into code and found : FormJsonserializer class and method named "deserializeObjectInternal()" at 744
else if (jsonReader.TokenType == Newtonsoft.Json.JsonToken::Boolean ||
jsonReader.TokenType == Newtonsoft.Json.JsonToken::Date ||
jsonReader.TokenType == Newtonsoft.Json.JsonToken::Float ||
jsonReader.TokenType == Newtonsoft.Json.JsonToken::Integer ||
jsonReader.TokenType == Newtonsoft.Json.JsonToken::String)
{
// This is the case for basic type values
if(jsonReader.Value && deserializedObject && currentJsonProperty)
{
}
}
jsonReader.Value comes = false but logic operator should be control it has a value or not. How can i fix that issue anyone can help me about it ?
Version : Dyanmics 365 FO