61 lines
1.4 KiB
Plaintext
61 lines
1.4 KiB
Plaintext
|
=encoding utf8
|
||
|
|
||
|
=head1 NAME
|
||
|
|
||
|
jslt - JSON query and transformation
|
||
|
|
||
|
=head1 SYNOPSIS
|
||
|
|
||
|
jslt I<transform.jslt> I<input.json>
|
||
|
|
||
|
=head1 DESCRIPTION
|
||
|
|
||
|
JSLT is a complete query and transformation language for JSON. The language
|
||
|
design is inspired by jq, XPath, and XQuery.
|
||
|
|
||
|
JSLT can be used as:
|
||
|
|
||
|
=over
|
||
|
|
||
|
=item *
|
||
|
a query language to extract values from JSON (.foo.bar[0]),
|
||
|
|
||
|
=item *
|
||
|
|
||
|
a filter/check language to test JSON objects (starts-with(.foo.bar[0], "http://")),
|
||
|
|
||
|
=item *
|
||
|
a transformation language to convert between JSON formats.
|
||
|
|
||
|
=back
|
||
|
|
||
|
Here is an example transform:
|
||
|
|
||
|
{
|
||
|
"time": round(parse-time(.published, "yyyy-MM-dd'T'HH:mm:ssX") * 1000),
|
||
|
"device_manufacturer": .device.manufacturer,
|
||
|
"device_model": .device.model,
|
||
|
"language": .device.acceptLanguage,
|
||
|
"os_name": .device.osType,
|
||
|
"os_version": .device.osVersion,
|
||
|
"platform": .device.platformType,
|
||
|
"user_properties": {
|
||
|
"is_logged_in" : boolean(.actor."spt:userId")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
=head1 SEE ALSO
|
||
|
|
||
|
L<Project page on GitHub|https://github.com/schibsted/jslt>.
|
||
|
|
||
|
=head1 LICENSE
|
||
|
|
||
|
Copyright (c) 2018 Schibsted Marketplaces Products & Technology AS
|
||
|
|
||
|
Licensed under the Apache License, Version 2.0 (the "License").
|
||
|
|
||
|
Unless required by applicable law or agreed to in writing, software distributed
|
||
|
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||
|
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||
|
specific language governing permissions and limitations under the License.
|