• Articles
  • Api Documentation
Show / Hide Table of Contents
  • AsyncGPUReadbackPluginNs
    • AsyncGPUReadbackPlugin
    • AsyncGPUReadbackPluginRequest
  • ZO
    • ZOMouseOrbitCamera
  • ZO.Controllers
    • ZO2FingerGripController
    • ZOLinearActuator
    • ZOLinearActuator.Axis
    • ZOServoMotorActuator
  • ZO.Document
    • ZOSerializationInterface
    • ZOSimDocumentRoot
    • ZOSimOccurrence
  • ZO.Math
    • ZOGaussianNoiseModel
    • ZOMathUtil
    • ZOMatrix4x4Util
    • ZORandom
  • ZO.Networking
    • ZOBinaryMessagePublisher
    • ZOBinaryMessageSubscriber
    • ZOJSONMessagePublisher
    • ZOJSONMessageSubscriber
    • ZOPubSubHeader
    • ZOTCPServer
  • ZO.Physics
    • ZOArticulatedBody
    • ZOFixedJoint
    • ZOHingeJoint
    • ZOJointInterface
    • ZOPIDController
    • ZOSpeedLimiter
  • ZO.ROS
    • ZOROSActionServer<TActionMessage, TGoalMessage>
    • ZOROSAPI
    • ZOROSBridgeConnection
    • ZOROSBridgeConnection.ROSBridgeConnectionChangeHandler
    • ZOROSBridgeConnection.SerializationType
  • ZO.ROS.Controllers
    • ControllerStateEnum
    • ZOArmController
    • ZODifferentialDriveController
    • ZOROSControllerInterface
  • ZO.ROS.MessageTypes
    • ZOROSMessageInterface
  • ZO.ROS.MessageTypes.ActionLib
    • ActionStatusEnum
    • GoalIDMessage
    • GoalStatusArrayMessage
    • GoalStatusMessage
    • ZOROSActionGoalMessageInterface
    • ZOROSActionMessageInterface
  • ZO.ROS.MessageTypes.Control
    • FollowJointTrajectoryActionFeedback
    • FollowJointTrajectoryActionGoal
    • FollowJointTrajectoryActionMessage
    • FollowJointTrajectoryActionResult
    • FollowJointTrajectoryFeedback
    • FollowJointTrajectoryGoal
    • FollowJointTrajectoryResult
    • JointToleranceMessage
    • JointTrajectoryControllerStateMessage
  • ZO.ROS.MessageTypes.ControllerManager
    • ControllerStateMessage
    • HardwareInterfaceResourcesMessage
    • ListControllersResponse
    • ListControllerTypesServiceResponse
    • LoadControllerServiceRequest
    • LoadControllerServiceResponse
    • ReloadControllerLibrariesServiceRequest
    • ReloadControllerLibrariesServiceResponse
    • SwitchControllerServiceRequest
    • SwitchControllerServiceResponse
    • UnloadControllerServiceRequest
    • UnloadControllerServiceResponse
  • ZO.ROS.MessageTypes.Gazebo
    • SpawnModelServiceRequest
    • SpawnModelServiceResponse
  • ZO.ROS.MessageTypes.Geometry
    • PointMessage
    • PoseMessage
    • PoseWithCovarianceMessage
    • QuaternionMessage
    • TransformMessage
    • TransformStampedMessage
    • TwistMessage
    • TwistWithCovarianceMessage
    • Vector3Message
  • ZO.ROS.MessageTypes.Nav
    • OdometryMessage
  • ZO.ROS.MessageTypes.ROSAPI
    • GetParamNamesResponse
    • GetParamResponse
    • GetParamServiceRequest
    • HasParamResponse
    • HasParamServiceRequest
    • SetParamServiceRequest
  • ZO.ROS.MessageTypes.ROSGraph
    • ClockMessage
  • ZO.ROS.MessageTypes.Sensor
    • CameraInfoMessage
    • ImageMessage
    • ImuMessage
    • JointStateMessage
    • LaserScanMessage
    • RegionOfInterestMessage
  • ZO.ROS.MessageTypes.Std
    • DurationMessage
    • EmptyServiceRequest
    • EmptyServiceRespone
    • HeaderMessage
    • Int32Message
    • SetBoolServiceRequest
    • SetBoolServiceResponse
    • StringMessage
    • TimeMessage
  • ZO.ROS.MessageTypes.TF2
    • TFMessage
  • ZO.ROS.MessageTypes.Trajectory
    • JointTrajectoryMessage
    • JointTrajectoryPointMessage
  • ZO.ROS.MessageTypes.ZOSim
    • ZOSimDeleteModelRequest
    • ZOSimDeleteModelResponse
    • ZOSimPrefabSpawnRequest
    • ZOSimPrefabSpawnResponse
    • ZOSimSpawnServiceRequest
    • ZOSimSpawnServiceResponse
  • ZO.ROS.Publisher
    • ZOROSImagePublisher
    • ZOROSIMUPublisher
    • ZOROSIMUPublisher.CoordinateSystemEnum
    • ZOROSJointStatesPublisher
    • ZOROSLaserScanPublisher
    • ZOROSRGBDepthPublisher
    • ZOROSStereoImagePublisher
    • ZOROSTransformPublisher
  • ZO.ROS.Unity
    • ZOROSUnityGameObjectBase
    • ZOROSUnityInterface
    • ZOROSUnityManager
    • ZOROSUnityManager.ROSBridgeConnectionChangeHandler
  • ZO.ROS.Unity.Docker
    • ZOROSLaunchParameters
  • ZO.ROS.Unity.Service
    • ZOControllerManagerService
    • ZOSimDeleteModelService
    • ZOSimPrefabSpawnService
    • ZOSimResetSimulationService
    • ZOSimSpawnService
  • ZO.Sensors
    • ZOContactDetector
    • ZOContactSwitchDualChannel
    • ZOIMU
    • ZOLIDAR2D
    • ZOLIDAR3D
    • ZOLIDAR3D.ReferenceFrame
    • ZORaycastJobBatch
    • ZORGBCamera
    • ZORGBDepthCamera
    • ZORGBDepthCamera.FrameOutputType
  • ZO.Util
    • ZOCenterOfMass
    • ZOClock
    • ZODocker
    • ZODocker.VolumeMapEntry
    • ZODockerRunParameters
    • ZODrawArc
    • ZODrawCircle
    • ZOEarthUtils
    • ZOEarthUtils.GeoPoint
    • ZOEarthUtils.HomeGeoPoint
    • ZOFrequencyCounter
    • ZOFrequencyCounter.TimeSourceType
    • ZOGameObjectBase
    • ZOMagnetometer
    • ZOMoveTest
    • ZOMoveTest.MoveTypeEnum
    • ZORandomizePhysics
    • ZORandomizeTransform
    • ZOReadOnlyAttribute
    • ZOSystem
    • ZOTurnOffSelfCollision
  • ZO.Util.Extensions
    • ZOJSONExtensions
  • ZO.Util.Rendering
    • ZOAsyncGPUReadbackPlugin
    • ZOAsyncGPUReadbackPluginRequest

Class ZOJSONExtensions

Inheritance
System.Object
ZOJSONExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: ZO.Util.Extensions
Assembly: Unity.ZeroSim.dll
Syntax
public static class ZOJSONExtensions

Methods

| Improve this Doc View Source

ToColor(JToken)

Convert JSON token to Unity Color. RGBA order.

Declaration
public static Color ToColor(this JToken json)
Parameters
Type Name Description
Newtonsoft.Json.Linq.JToken json

JSON Token. Must be a JArray! (R, G, B, A)

Returns
Type Description
UnityEngine.Color

Unity Color

| Improve this Doc View Source

ToColorOrDefault(JObject, String, Color)

Get Color value of key or supplied default value.

Declaration
public static Color ToColorOrDefault(this JObject json, string key, Color defaultValue)
Parameters
Type Name Description
Newtonsoft.Json.Linq.JObject json
System.String key
UnityEngine.Color defaultValue
Returns
Type Description
UnityEngine.Color
| Improve this Doc View Source

ToJSON(Color)

Convert Unity Color to JSON token.

Declaration
public static JToken ToJSON(this Color v)
Parameters
Type Name Description
UnityEngine.Color v

Unity Quaternion

Returns
Type Description
Newtonsoft.Json.Linq.JToken

JSON token

| Improve this Doc View Source

ToJSON(Quaternion)

Convert Unity Quaternion to JSON token.

Declaration
public static JToken ToJSON(this Quaternion v)
Parameters
Type Name Description
UnityEngine.Quaternion v

Unity Quaternion

Returns
Type Description
Newtonsoft.Json.Linq.JToken

JSON token

| Improve this Doc View Source

ToJSON(Vector2)

Convert Unity Vector2 to JSON token.

Declaration
public static JToken ToJSON(this Vector2 v)
Parameters
Type Name Description
UnityEngine.Vector2 v

Unity Quaternion

Returns
Type Description
Newtonsoft.Json.Linq.JToken

JSON token

| Improve this Doc View Source

ToJSON(Vector3)

Convert Unity Vector3 to JSON token.

Declaration
public static JToken ToJSON(this Vector3 v)
Parameters
Type Name Description
UnityEngine.Vector3 v

Unity Vector3

Returns
Type Description
Newtonsoft.Json.Linq.JToken

JSON token

| Improve this Doc View Source

ToQuaternion(JToken)

Convert JSON token to Unity Quaternion.

Declaration
public static Quaternion ToQuaternion(this JToken json)
Parameters
Type Name Description
Newtonsoft.Json.Linq.JToken json

JSON Token. Must be a JArray!

Returns
Type Description
UnityEngine.Quaternion

Unity Quaternion

| Improve this Doc View Source

ToQuaternionOrDefault(JObject, String, Quaternion)

Get Quaternion value of key or supplied default value.

Declaration
public static Quaternion ToQuaternionOrDefault(this JObject json, string key, Quaternion defaultValue)
Parameters
Type Name Description
Newtonsoft.Json.Linq.JObject json
System.String key
UnityEngine.Quaternion defaultValue
Returns
Type Description
UnityEngine.Quaternion
| Improve this Doc View Source

ToVector2(JToken)

Convert JSON token to Unity Vector2.

Declaration
public static Vector2 ToVector2(this JToken json)
Parameters
Type Name Description
Newtonsoft.Json.Linq.JToken json

JSON Token. Must be a JArray! (R, G, B, A)

Returns
Type Description
UnityEngine.Vector2

Unity Color

| Improve this Doc View Source

ToVector2OrDefault(JObject, String, Vector2)

Get Vector2 value of key or supplied default value.

Declaration
public static Vector2 ToVector2OrDefault(this JObject json, string key, Vector2 defaultValue)
Parameters
Type Name Description
Newtonsoft.Json.Linq.JObject json
System.String key
UnityEngine.Vector2 defaultValue
Returns
Type Description
UnityEngine.Vector2
| Improve this Doc View Source

ToVector3(JToken)

Convert JSON token to Unity Vector3.

Declaration
public static Vector3 ToVector3(this JToken json)
Parameters
Type Name Description
Newtonsoft.Json.Linq.JToken json

JSON Token. Must be a JArray!

Returns
Type Description
UnityEngine.Vector3
| Improve this Doc View Source

ToVector3OrDefault(JObject, String, Vector3)

Get Vector3 value of key or supplied default value.

Declaration
public static Vector3 ToVector3OrDefault(this JObject json, string key, Vector3 defaultValue)
Parameters
Type Name Description
Newtonsoft.Json.Linq.JObject json
System.String key
UnityEngine.Vector3 defaultValue
Returns
Type Description
UnityEngine.Vector3
| Improve this Doc View Source

ValueOrDefault<T>(JObject, String, T)

Get value of key or if does not exist returns supplied default value. NOTE: will not work for "non-simple" values such as Vector3 or Quaternion.

Declaration
public static T ValueOrDefault<T>(this JObject json, string key, T defaultValue)
Parameters
Type Name Description
Newtonsoft.Json.Linq.JObject json

JObject that we are extending

System.String key

JSON key

T defaultValue

Default value if key does not exist.

Returns
Type Description
T

Value

Type Parameters
Name Description
T
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX