summary:"Gets the parent <xref uid=\"com.azure.json.JsonWriteContext\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteContext\"></xref>."
syntax:"public JsonWriteContext getParent()"
desc:"Gets the parent <xref uid=\"com.azure.json.JsonWriteContext\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteContext\"></xref>.\n\n<xref uid=\"com.azure.json.JsonWriteContext.ROOT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteContext#ROOT\"></xref> and <xref uid=\"com.azure.json.JsonWriteContext.COMPLETED\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteContext#COMPLETED\"></xref> are terminal writing contexts and don't have parent contexts. These are the only writing contexts that will return null."
summary:"Gets the <xref uid=\"com.azure.json.JsonWriteState\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState\"></xref> associated to the writing context."
syntax:"public JsonWriteState getWriteState()"
desc:"Gets the <xref uid=\"com.azure.json.JsonWriteState\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState\"></xref> associated to the writing context."
returns:
description:"The <xref uid=\"com.azure.json.JsonWriteState\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState\"></xref> associated to the writing context."
summary:"Updates the context based on the <xref uid=\"com.azure.json.JsonToken\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken\"></xref> that was written."
parameters:
- description:"The <xref uid=\"com.azure.json.JsonToken\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken\"></xref> triggering the update."
desc:"Updates the context based on the <xref uid=\"com.azure.json.JsonToken\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken\"></xref> that was written.\n\nTokens <xref uid=\"com.azure.json.JsonToken.BOOLEAN\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#BOOLEAN\"></xref>, <xref uid=\"com.azure.json.JsonToken.NULL\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#NULL\"></xref>, <xref uid=\"com.azure.json.JsonToken.NUMBER\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#NUMBER\"></xref>, and <xref uid=\"com.azure.json.JsonToken.STRING\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#STRING\"></xref> can mutate the current state in three different ways. If the current context is <xref uid=\"com.azure.json.JsonWriteContext.ROOT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteContext#ROOT\"></xref> then <xref uid=\"com.azure.json.JsonWriteContext.COMPLETED\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteContext#COMPLETED\"></xref> is the updated context as the JSON stream has completed writing. If the current context is <xref uid=\"com.azure.json.JsonWriteState.ARRAY\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState#ARRAY\"></xref> then this context is returned without mutation as writing an element to an array doesn't complete the array. Otherwise, the parent context is returned as the only other legal context is <xref uid=\"com.azure.json.JsonWriteState.FIELD\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState#FIELD\"></xref> and writing a value completes the field.\n\nTokens <xref uid=\"com.azure.json.JsonToken.END_OBJECT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#END_OBJECT\"></xref> and <xref uid=\"com.azure.json.JsonToken.END_ARRAY\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#END_ARRAY\"></xref> complete the current context and prepare set the parent context for return. If the parent context is <xref uid=\"com.azure.json.JsonWriteContext.ROOT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteContext#ROOT\"></xref> then <xref uid=\"com.azure.json.JsonWriteContext.COMPLETED\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteContext#COMPLETED\"></xref> is the updated context as the JSON stream has completed writing. Otherwise, if the parent context is <xref uid=\"com.azure.json.JsonWriteState.FIELD\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState#FIELD\"></xref> that will be completed as well as the field has completed writing.\n\nTokens <xref uid=\"com.azure.json.JsonToken.START_OBJECT\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#START_OBJECT\"></xref>, <xref uid=\"com.azure.json.JsonToken.START_ARRAY\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#START_ARRAY\"></xref>, and <xref uid=\"com.azure.json.JsonToken.FIELD_NAME\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken#FIELD_NAME\"></xref> create a child context where the current context becomes the parent context.\n\nField and value APIs in <xref uid=\"com.azure.json.JsonWriter\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriter\"></xref>, such as <xref uid=\"com.azure.json.JsonWriter.writeStringField(java.lang.String,java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriter#writeStringField(String, String)\"></xref>, are self-closing operations that will maintain the current context."
summary:"Determines whether the <xref uid=\"com.azure.json.JsonToken\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken\"></xref> is allowed to be written based on the <xref uid=\"com.azure.json.JsonWriteState\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonWriteState\"></xref>."
parameters:
- description:"The <xref uid=\"com.azure.json.JsonToken\" data-throw-if-not-resolved=\"false\" data-raw-source=\"JsonToken\"></xref> that is being validated for being writable in the current state."
desc:"Context of JSON handling.\n\nWriting context is immutable, any calls to <xref uid=\"com.azure.json.JsonWriteContext.updateContext(com.azure.json.JsonToken)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#updateContext(JsonToken)\"></xref> will result in either a previous context being returned or the creation of a new context."