![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
github.com/stretchr/objx
Objx - Go package for dealing with maps, slices, JSON and other data.
Get started:
Objx provides the objx.Map
type, which is a map[string]interface{}
that exposes a powerful Get
method (among others) that allows you to easily and quickly get access to data within the map, without having to worry too much about type assertions, missing data, default values etc.
Objx uses a predictable pattern to make access data from within map[string]interface{}
easy. Call one of the objx.
functions to create your objx.Map
to get going:
m, err := objx.FromJSON(json)
NOTE: Any methods or functions with the Must
prefix will panic if something goes wrong, the rest will be optimistic and try to figure things out without panicking.
Use Get
to access the value you're interested in. You can use dot and array
notation too:
m.Get("places[0].latlng")
Once you have sought the Value
you're interested in, you can use the Is*
methods to determine its type.
if m.Get("code").IsStr() { // Your code... }
Or you can just assume the type, and use one of the strong type methods to extract the real value:
m.Get("code").Int()
If there's no value there (or if it's the wrong type) then a default value will be returned, or you can be explicit about the default value.
Get("code").Int(-1)
If you're dealing with a slice of data as a value, Objx provides many useful methods for iterating, manipulating and selecting that data. You can find out more by exploring the index below.
A simple example of how to use Objx:
// Use MustFromJSON to make an objx.Map from some JSON
m := objx.MustFromJSON(`{"name": "Mat", "age": 30}`)
// Get the details
name := m.Get("name").Str()
age := m.Get("age").Int()
// Get their nickname (or use their name if they don't have one)
nickname := m.Get("nickname").Str(name)
Since objx.Map
is a map[string]interface{}
you can treat it as such. For example, to range
the data, do what you would expect:
m := objx.MustFromJSON(json)
for key, value := range m {
// Your code...
}
To install Objx, use go get:
go get github.com/stretchr/objx
To update Objx to the latest version, run:
go get -u github.com/stretchr/objx
We currently support the three recent major Go versions.
Please feel free to submit issues, fork the repository and send pull requests!
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.