NAME
IO::K8s::ApiextensionsApiserver::Pkg::Apis::Apiextensions::V1::JSON - JSON represents any valid JSON value. These types are supported: bool, int64, float64, string, []interface{}, map[string]interface{} and nil.
VERSION
version 1.110
DESCRIPTION
apiextensions.k8s.io/v1.JSON is a free-form value: whatever the CRD author wrote for default, example or an enum entry. It serializes as the bare value, not as a wrapper object, so this class only carries the value through inflation and back out again unchanged.
Inflation goes through "struct_to_object" in IO::K8s, which hands any class providing FROM_STRUCT the raw structure instead of treating it as a hashref of attributes.
my $props = $k8s->struct_to_object(
'Apiextensions::V1::JSONSchemaProps',
{ type => 'string', default => 'nginx' },
);
$props->default->value; # 'nginx'
$props->TO_JSON->{default} # 'nginx' — bare, not { value => 'nginx' }
The spec_* methods of IO::K8s::Role::SpecBuilder walk through a field of this class into its value, the way the wire JSON reads: on a K3s HelmChart, spec_set('values.replicaCount', 3) serializes as values: {"replicaCount": 3}.
value
The wrapped value. Any Perl structure that survives JSON encoding: a plain scalar, a hashref, an arrayref, a JSON boolean, or undef.
FROM_STRUCT
my $json = $class->FROM_STRUCT($struct, $k8s);
Inflation hook called by "struct_to_object" in IO::K8s. Wraps $struct unchanged, except that a hash or an array is copied one level -- the rule inflation applies to every array or hash of scalars. A key added to or removed from the source hash, or an element pushed onto the source array, after inflation does not reach the object. A container nested inside the value is not copied and still shares its contents with the source. A plain scalar, undef or a JSON boolean is kept as given.
The same hook builds the value a field of this type is given through new, its setter or a spec_* write of IO::K8s::Role::SpecBuilder, whatever its shape -- values => [1, 2] on a K3s HelmChartSpec as readily as a hash; see "k8s" in IO::K8s::Resource.
TO_JSON
Returns the wrapped value, a hash or an array copied one level -- the same depth "FROM_STRUCT" copies on the way in and "TO_JSON" in IO::K8s::Role::Resource copies an untyped container on the way out. A key added to or removed from the returned hash, or an element pushed onto the returned array, does not reach the object; a container nested inside the value is still shared with it. A plain scalar, undef or a JSON boolean is returned as it is.
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/pplu/io-k8s-p5/issues.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHORS
Torsten Raudssus <getty@cpan.org>
Jose Luis Martinez Torres <jlmartin@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2018-2026 by Jose Luis Martinez Torres <jlmartin@cpan.org>.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004