private void visitLiteral(LiteralExpression expression, boolean nestedInsideLiteral) {
            if (!nestedInsideLiteral) {
                builder.append('`');
            }

            switch (expression.getType()) {
                case NUMBER:
                    builder.append(expression.expectNumberValue());
                    break;
                case NULL:
                case ANY: // treat "any" like null
                    builder.append("null");
                    break;
                case ARRAY:
                    builder.append('[');
                    int ai = 0;
                    for (Object value : expression.expectArrayValue()) {
                        LiteralExpression exp = LiteralExpression.from(value);
                        visitLiteral(exp, true);
                        if (ai++ < expression.expectArrayValue().size() - 1) {
                            builder.append(", ");
                        }
                    }
                    builder.append(']');
                    break;
                case OBJECT:
                    builder.append('{');
                    int oi = 0;
                    Set<Map.Entry<String, Object>> objectEntries = expression.expectObjectValue().entrySet();
                    for (Map.Entry<String, Object> objectEntry : objectEntries) {
                        builder.append('"')
                                .append(sanitizeString(objectEntry.getKey(), true))
                                .append("\": ");
                        LiteralExpression exp = LiteralExpression.from(objectEntry.getValue());
                        visitLiteral(exp, true);
                        if (oi++ < objectEntries.size() - 1) {
                            builder.append(", ");
                        }
                    }
                    builder.append('}');
                    break;
                case STRING:
                    builder.append('"')
                            .append(sanitizeString(expression.expectStringValue(), true))
                            .append('"');
                    break;
                case BOOLEAN:
                    builder.append(expression.expectBooleanValue());
                    break;
                case EXPRESSION:
                    // fall-through
                default:
                    throw new JmespathException("Unable to serialize literal runtime value: " + expression);
            }

            if (!nestedInsideLiteral) {
                builder.append('`');
            }
        }
Serialize the given JMESPath expression to a string.

@param expression JMESPath expression to serialize.
@return Returns the serialized expression.
smithy-jmespath/src/main/java/software/amazon/smithy/jmespath/ExpressionSerializer.java