Package: wpt-parser
WPT ParserGetting StartedPrerequisteInstallationExamplesKey TypesAvailable MethodsGetting StartedPrerequisitesPython >= 3.6.xpipInstallation$ pip install wpt-parserExamplesUsing the JSON Parser# import the class
from WPTParser.Fetch import Fetch
from WPTParser.JSONParser import JSONParser

test_json = Fetch().json()
keys = ['data.median.firstView.loadTime',]
# returns a new dict with specified keys
JSONParser(test_json).pick(keys=keys).exec()Key Types:key_nameWorks like simple JSON extraction. Provide the name of the key and boom!.For extraction from beyond first level, append keys with a separator and providekey_delimiterfor the program to recognize the start of next level.Example:"""
{
    keylevel11: {
        keylevel21: value,
        keylevel22: {
            keylevel31: value
        }
    }
}
"""
# key to extract first level
# keylevel11
# returns {keylevel21: ...}

# key to extract second level, first key
# keylevel11.keylevel21
# returns value[list_index]When you have a list as value and you want to extract a specific index value/object.For extraction from beyond first level, append keys with a separator and providekey_delimiterfor the program to recognize the start of next level.Example:"""
{
    keylevel11: {
        keylevel21: [
            1, 2, 3
        ],
        keylevel22: {
            keylevel31: value
        }
    }
}
"""
# key to extract second level, third index
# keylevel11.keylevel21.[2]
# returns 3[{key=value}]When you have a unordered list of object and you want extract a specific object from the list based on the key and value inside the objectFor extraction from beyond first level, append keys with a separator and providekey_delimiterfor the program to recognize the start of next level.Example:"""
{
    keylevel11: {
        keylevel21: [
            1, 2, 3
        ],
        keylevel22: {
            keylevel31: value
        },
        keylevel23: [
            {
                name: Awesome,
            },
            {
                name: Package
            }
        ]
    }
}
"""
# key to extract second level, and from that extarct the object with name = Awesome
# keylevel11.keylevel23.[{name=Awesome}]
# return {name: Awesome}[{key~regex}]When you have a unordered list of object and you want extract a specific object from the list based on the key and a regex of value inside the objectFor extraction from beyond first level, append keys with a separator and providekey_delimiterfor the program to recognize the start of next level.The regex search is case sensitive. You do not need to add//orr''to write your regex.The search will find all the matches and return a listExample:"""
{
    keylevel11: {
        keylevel21: [
            1, 2, 3
        ],
        keylevel22: {
            keylevel31: value
        },
        keylevel23: [
            {
                name: Awesome123,
            },
            {
                name: Package
            }
        ]
    }
}
"""
# key to extract second level, and from that extarct the object with name matching Awesome
# keylevel11.keylevel23.[{name~Awesome}]
# return [{name: Awesome}]Available MethodsJSONParserMethodParamstypedefaultDescriptionpickkeystrNoneselects a key to be returnedpickkeyslist[]selects a list key to be returnedpickkey_delimiterstr"."Separator used to identify multi level JSONpickkey_mappingdict{}Mapping of keys for picking with custom key name.FetchMethodParamstypedefaultDescriptionjsontest_idstrNonetest_id for a wpt or a speed curve testjsonWPT_URIstr'https://webpagetest.org'URI for your WPT instanceNote:The package is under development and will be prone to more frequent updates