Sign in Join
FPDoc Onlineexperiment

TJSONToPascal class

In unit fpJsonToPas

Main class for generating Pascal code from JSON data

Declaration

pascal
TJSONToPascal = class(TComponent)

Inheritance

  1. TJSONToPascal
  2. TComponent
  3. TPersistent
  4. TObject

Description

TJSONToPascal is the core component that generates Object Pascal class definitions from JSON data structures. It analyzes the JSON input and creates complete Pascal unit code with classes that can serialize to and from JSON format.

The class provides comprehensive control over the code generation process through various properties and options. Generated classes include appropriate property declarations, constructor/destructor methods, and optional JSON serialization methods.

Properties

JSONDatapublicJSON data object to generate code from
JSONStreampublicStream containing JSON data to generate code from
ActivepublishedAutomatically execute code generation when set to True
OptionspublishedCode generation options
JSONpublishedJSON string to generate code from
CodepublishedGenerated Pascal unit code
PropertyMappublishedManual type mappings for JSON properties
DestUnitNamepublishedName of the generated Pascal unit
DefaultParentNamepublishedDefault base class for generated objects
IndentSizepublishedNumber of spaces for code indentation
ExtraUnitNamespublishedAdditional units for the uses clause
PropertyTypeSuffixpublishedSuffix for generated object and array type names
FieldPrefixpublishedPrefix for private field names
ObjectConstructorArgumentspublishedArguments for object constructors
ToplevelObjectClassNamepublishedName of the main generated class

Methods

AddSemiColonToLastLineprotected
Indentprotected
Undentprotected
AddLnprotected
AddIndentedprotected
CreatePropertyMapprotected
GetJSONDataprotected
IsDateTimeValueprotected
GetDefaultParentNameprotected
GetPropertyTypeNameprotected
PathToTypeNameprotected
AddToPathprotected
CleanPropertyNameprotected
GetPropertyNameprotected
GenerateAssignprotected
GenerateAssignDelphiprotected
GenerateCreateArrayprotected
GenerateSaveArrayprotected
GenerateClearArrayprotected
GenerateCreateObjectfpJSONprotected
GenerateLoadJSONDelphiprotected
GenerateLoadJSONfpJSONprotected
GenerateSaveJSONDelphiprotected
GenerateSaveJSONfpJSONprotected
GenerateArrayDeclarationprotected
GenerateObjectDeclarationprotected
GenerateArrayImplementationprotected
GenerateObjectImplementationprotected
GetExtraUnitNamesprotected
ClearGeneratedTypesprotected
GenerateInterfaceHeaderprotected
GenerateDeclarationprotected
GenerateImplementationHeaderprotected
GenerateImplementationprotected
GenerateImplementationEndprotected
CreatepublicCreates a new TJSONToPascal instance
DestroypublicDestroys the TJSONToPascal instance
ExecutepublicGenerates Pascal code from JSON data

Inherited

From TComponent (74)

_AddRef _Release BeforeDestruction CanObserve ChangeName ComObject ComponentCount ComponentIndex Components ComponentState ComponentStyle DefineProperties DesignInfo DestroyComponents Destroying ExecuteAction FindComponent FreeNotification FreeOnRelease GetChildOwner GetChildParent GetChildren GetDeltaStreams GetEnumerator GetIDsOfNames GetNamePath GetObservers GetOwner GetParentComponent GetTypeInfo GetTypeInfoCount HasParent iicrGetComponent InsertComponent Invoke IsImplementorOf Loaded Loading Name Notification ObserverAdded Observers OnGetDeltaStreams Owner PaletteCreated QueryInterface ReadDeltaState ReadDeltaStream ReadState ReferenceInterface RemoveComponent RemoveFreeNotification RemoveFreeNotifications SafeCallException SetAncestor SetChildOrder SetDesigning SetDesignInstance SetInline SetName SetParentComponent SetSubComponent Tag ToString TToStringNameMode UpdateAction Updated UpdateRegistry Updating ValidateContainer ValidateInsert ValidateRename VCLComObject WriteState

From TPersistent (5)

Assign AssignTo FPOAttachObserver FPODetachObserver FPONotifyObservers

From TObject (37)

AfterConstruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandler DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName newinstance QualifiedClassName StringMessageTable SystemHasExtendedRTTI UnitName

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.