put @context at the top of the JSON output

This commit is contained in:
Matthias Pfefferle 2023-06-28 16:42:20 +02:00
parent c266c927da
commit 913c9aeac4

View file

@ -587,6 +587,13 @@ class Base_Object {
} }
} }
// replace 'context' key with '@context' and move it to the top.
if ( array_key_exists( 'context', $array ) ) {
$context = $array['context'];
unset( $array['context'] );
$array = array_merge( array( '@context' => $context ), $array );
}
$class = new \ReflectionClass( $this ); $class = new \ReflectionClass( $this );
$class = strtolower( $class->getShortName() ); $class = strtolower( $class->getShortName() );