Esempio n. 1
0
        public string GetPrePath()
        {
            var builder = new JsonPathBuilder(this.ToString());

            builder.Segments[1].Index = builder.Segments[1].Index - 1;
            return(builder.ToString());
        }
Esempio n. 2
0
        private void ResolveToken(JToken token)
        {
            switch (token.Type)
            {
            case JTokenType.Object:
                jsonBuilder.RemovePath(token.Path);
                if (token.Children().Count() > 0)
                {
                    InternalResolve(token);
                }
                break;

            case JTokenType.Property:
                PropertyName = (token as JProperty).Name;
                jsonBuilder.AppendPath(token.Path);
                InternalResolve(token);
                jsonBuilder.RemovePath(token.Path);
                break;

            case JTokenType.String:
                var strValue = token.Value <string>();
                if (strValue == $"@{PropertyName}@")
                {
                    var parentToken  = GetParentToken();
                    var replaceToken = newJsonObjectConfig.SelectToken(jsonBuilder.ToString());
                    replaceToken.Replace(parentToken);
                }
                else if (strValue.StartsWith("="))
                {
                    // Replacement - Resolve for the Engine not in Qlik Script.
                    var newValue = strValue.Replace("$@(", "$(");
                    // Replacement - GRPC fix for char "$".
                    newValue = Regex.Replace(newValue, "chr\\(36\\)\\&", "$", RegexOptions.IgnoreCase);

                    var replaceToken = newJsonObjectConfig.SelectToken(jsonBuilder.ToString());
                    replaceToken.Replace(newValue);
                }
                break;

            default:
                break;
            }
        }