Banyo Convert Dictionary To Data Swift

NSData Foundation Apple Developer Documentation

GitHub tristanhimmelman/ObjectMapper Simple JSON Object

Convert dictionary to data swift

Python Nested Dictionary (With Examples). Swift 4 dictionaries use unique identifier known as a key to store a value which later can be referenced and looked up through the same key. Unlike items in an array, items in a dictionary do not have a specified order. You can use a dictionary when you need to look up values based on their identifiers., 15/07/2019 · You’ll also need to convert the saved data sent over the network to a suitable format before using it in your app. This reverse process is called decoding or deserialization. In this tutorial, you’ll learn all you need to know about encoding and decoding in Swift by managing your very own toy store. You’ll explore the following topics.

Codable And JSON In Swift (How To) – LearnAppMaking

Chapter 11 Dictionaries We Swift. Convert Dictionary to a JSON string in swift . GitHub Gist: instantly share code, notes, and snippets., Mutability of Collections¶. If you create an array, a set, or a dictionary, and assign it to a variable, the collection that is created will be mutable.This means that you can change (or mutate) the collection after it’s created by adding, removing, or changing items in the collection.If you assign an array, a set, or a dictionary to a constant, that collection is immutable, and its size.

However, what you should do is send the data (jsonData) since that is the actual representation of the data that passes over a network. Converting to a string in order to convert it back to a stream of bytes seems unnecessary. Also, the JSON data is (presumably) UTF-8, and so trying to pass it through a conversion to ASCII can fail. (Perhaps Type Casting¶. Type casting is a way to check the type of an instance, or to treat that instance as a different superclass or subclass from somewhere else in its own class hierarchy.. Type casting in Swift is implemented with the is and as operators. These two operators provide a simple and expressive way to check the type of a value or cast a value to a different type.

First, conversion and display of C# byte array into a string format, and second, conversion of C# bytes into actual characters of string. The BitConverter class in .NET Framework is provides functionality to convert base datatypes to an array of bytes, and an array of bytes to base data types. You use the JSONSerialization class to convert JSON to Foundation objects and convert Foundation objects to JSON.. A Foundation object that may be converted to JSON must have the following properties: The top level object is an NSArray or NSDictionary.. All objects are instances of NSString, NSNumber, NSArray, NSDictionary, or NSNull.. All dictionary keys are instances of NSString.

NSData and its mutable subclass NSMutable Data provide data objects, or object-oriented wrappers for byte buffers. Data objects let simple allocated buffers (that is, data with no embedded pointers) take on the behavior of Foundation objects. The size of the data is subject to a theoretical limit of about 8 exabytes (1 EB = 10В№вЃё bytes; in practice, the limit should not be a factor). The first two examples of dictionary creation may look familiar as these are Swift 3, Xcode 8 supported methods for dictionary creation. The first creates a new mutable dictionary type with a string definition as the key and value. After the dictionary is created on line 6 the subscript syntax is used to explicitly assign a value to a key.

15/07/2019 · You’ll also need to convert the saved data sent over the network to a suitable format before using it in your app. This reverse process is called decoding or deserialization. In this tutorial, you’ll learn all you need to know about encoding and decoding in Swift by managing your very own toy store. You’ll explore the following topics 06/02/2015 · Swift Programming from Scratch The Swift Sandbox is integrated, making the exercises interactive. Read more about the book here. First Steps Conditionals Types Loops Strings Arrays Functions Recursion Closures Tuples & Enums Dictionaries Chapter 11: Dictionaries A dictionary is an unordered collection that stores multiple values of the same type.

There’s also .nulTerminatedUTF8, which does the same thing, but then adds a nul-character to the end if your plan is to pass this somewhere as a C string (though if you’re doing that, you can probably also use .withCString or just use the implicit conversion for bridged C functions. In the previous Swift Arrays article, we learned how we can store multiple values in a variable/constant. In this article, we are going to discuss how we can store data/values as key value pairs. What is a dictionary? A dictionary is simply a container that can hold multiple data …

There’s also .nulTerminatedUTF8, which does the same thing, but then adds a nul-character to the end if your plan is to pass this somewhere as a C string (though if you’re doing that, you can probably also use .withCString or just use the implicit conversion for bridged C functions. I am not sure if I am using the dictionary or the data object or both incorrectly. I m trying to get used to the switch to swift but I’m having a little trouble.

Swift 3 encompasses many different small and big changes to the language. One of them is the introduction of value type wrappers for common Foundation reference types such as NSData (Data) or NSDate (Date).These new types differ not only in their memory behaviour and name, their methods also differ from their reference-based counterparts 1.From small changes to new method names up to big 19/09/2019В В· How to convert a String to an Int. Swift version: 5.1. Paul Hudson @twostraws September 19th 2019. If you have an integer hiding inside a string, you can convert between the two just by using the integer's initializer, like this:

In other languages, similar data types are known as hashes or associated arrays. Create a new dictionary by using a dictionary literal. A dictionary literal is a comma-separated list of key-value pairs, in which a colon separates each key from its associated value, surrounded by square brackets. You can assign a dictionary literal to a variable Swift 3 encompasses many different small and big changes to the language. One of them is the introduction of value type wrappers for common Foundation reference types such as NSData (Data) or NSDate (Date).These new types differ not only in their memory behaviour and name, their methods also differ from their reference-based counterparts 1.From small changes to new method names up to big

Swift 3 encompasses many different small and big changes to the language. One of them is the introduction of value type wrappers for common Foundation reference types such as NSData (Data) or NSDate (Date).These new types differ not only in their memory behaviour and name, their methods also differ from their reference-based counterparts 1.From small changes to new method names up to big Questions: I want to convert my Dictionary> to JSON string. Does anyone know how to achieve this in C#? Answers: Serializing data structures containing only numeric or boolean values is fairly straightforward. If you don’t have much to serialize, you can write a method for your specific type. For a Dictionary> as you have

Swift Dictionary Collections String dictionaries allow data to be stored and managed in the form of key-value pairs. Dictionaries fulfill a similar purpose to arrays, except each item stored in the dictionary has associated with it a unique key (to be precise, the key is unique to the particular dictionary object) which can be used to reference and access the corresponding value. Tuple is a group of different values represented as one . According to apple, a tuple type is a comma-separated list of zero or more types, enclosed in parentheses. It’s a miniature version of a…

- Add item to dictionary - Check if 2 dictionaries are equal - Check if object is a dictionary - Create an empty dictionary - Get array of keys in dictionary - Get array of values in dictionary - Get dictionary value for key - Get the size of a dictionary - Loop through dictionary - Remove all items from dictionary - Remove item from dictionary 15/07/2019 · You’ll also need to convert the saved data sent over the network to a suitable format before using it in your app. This reverse process is called decoding or deserialization. In this tutorial, you’ll learn all you need to know about encoding and decoding in Swift by managing your very own toy store. You’ll explore the following topics

To convert this JSON string to a Beer instance, we’ll mark our types as Codable. Codable is actually what Swift calls a protocol composition type, consisting of Encodable & Decodable, so if you only care about unidirectional conversion you can just adopt the appropriate protocol. This is a new feature of Swift 4. Convert Dictionary to a JSON string in swift . GitHub Gist: instantly share code, notes, and snippets.

This Swift code example will demonstrate how to convert JSON String to NSDictionary in Swift 2 and Swift 3. Convert JSON String to NSDictionary – Example in Swift 2 let jsonText = "{\"first_name\":\"Sergey\"}" var dictonary:NSDictionary? if let data = jsonText.dataUsingEncoding(NSUTF8StringEncoding) { do { dictonary = try NSJSONSerialization.JSONObjectWithData(data… Tuple is a group of different values represented as one . According to apple, a tuple type is a comma-separated list of zero or more types, enclosed in parentheses. It’s a miniature version of a…

Swift Dictionary Examples Use a dictionary to look up values from keys. Add elements and loop over tuples with for-in. Dictionary. In our memory we link keys to values. A snake is a reptile. A frog is an amphibian. Our memory is a form of key-value storage. A Swift Dictionary is a primary collection type. We use special syntax to specify key and value types. We add pairs with assignment. An In other languages, similar data types are known as hashes or associated arrays. Create a new dictionary by using a dictionary literal. A dictionary literal is a comma-separated list of key-value pairs, in which a colon separates each key from its associated value, surrounded by square brackets. You can assign a dictionary literal to a variable

Ultimate Guide to JSON Parsing with Swift 4 Ben Scheirman

Convert dictionary to data swift

How to Get array of keys in dictionary in Swift iSwift. In the previous Swift Arrays article, we learned how we can store multiple values in a variable/constant. In this article, we are going to discuss how we can store data/values as key value pairs. What is a dictionary? A dictionary is simply a container that can hold multiple data …, 15/07/2019 · You’ll also need to convert the saved data sent over the network to a suitable format before using it in your app. This reverse process is called decoding or deserialization. In this tutorial, you’ll learn all you need to know about encoding and decoding in Swift by managing your very own toy store. You’ll explore the following topics.

How to Get array of keys in dictionary in Swift iSwift

Convert dictionary to data swift

Swift Dictionaries - Tutorialspoint. Swift Dictionary Collections String dictionaries allow data to be stored and managed in the form of key-value pairs. Dictionaries fulfill a similar purpose to arrays, except each item stored in the dictionary has associated with it a unique key (to be precise, the key is unique to the particular dictionary object) which can be used to reference and access the corresponding value. What is a Dictionary Dictionaries and arrays make up the collection types of Swift. Collections are exactly what they say: a collection of values. The difference between an array and a dictionary is how you get the values in and out of the collection. Arrays, as we covered ….

Convert dictionary to data swift


Questions: I want to convert my Dictionary> to JSON string. Does anyone know how to achieve this in C#? Answers: Serializing data structures containing only numeric or boolean values is fairly straightforward. If you don’t have much to serialize, you can write a method for your specific type. For a Dictionary> as you have swift dictionary get value for key (1) I'm getting data from iTunes API with AFNetworking and I want to create a Dictionary with the response but I can't do it. Error: Cannot convert the expression's type "Dictionary " to type "Hashable" This is my code:

I am not sure if I am using the dictionary or the data object or both incorrectly. I m trying to get used to the switch to swift but I’m having a little trouble. Convert Dictionary to a JSON string in swift . GitHub Gist: instantly share code, notes, and snippets.

Tuple is a group of different values represented as one . According to apple, a tuple type is a comma-separated list of zero or more types, enclosed in parentheses. It’s a miniature version of a… What is a Dictionary Dictionaries and arrays make up the collection types of Swift. Collections are exactly what they say: a collection of values. The difference between an array and a dictionary is how you get the values in and out of the collection. Arrays, as we covered …

What is a Dictionary Dictionaries and arrays make up the collection types of Swift. Collections are exactly what they say: a collection of values. The difference between an array and a dictionary is how you get the values in and out of the collection. Arrays, as we covered … Convert Dictionary to a JSON string in swift . GitHub Gist: instantly share code, notes, and snippets.

What is a Dictionary Dictionaries and arrays make up the collection types of Swift. Collections are exactly what they say: a collection of values. The difference between an array and a dictionary is how you get the values in and out of the collection. Arrays, as we covered … NSData and its mutable subclass NSMutable Data provide data objects, or object-oriented wrappers for byte buffers. Data objects let simple allocated buffers (that is, data with no embedded pointers) take on the behavior of Foundation objects. The size of the data is subject to a theoretical limit of about 8 exabytes (1 EB = 10¹⁸ bytes; in practice, the limit should not be a factor).

What is a Dictionary Dictionaries and arrays make up the collection types of Swift. Collections are exactly what they say: a collection of values. The difference between an array and a dictionary is how you get the values in and out of the collection. Arrays, as we covered … [Updated to Swift 2.0 9/10/2015 SJL] I wrote early in my Swift tutorials a simple example of a dictionary But I really didn’t go too deep into all the ways one can use a dictionary. In this lesson we’ll bring everyone up to speed in using dictionaries, and for those who don’t know what a dictionary is, we’ll introduce them.

from - swift json to dictionary Convertir le dictionnaire NSDictionary en swift (2) Maintenant, je sais que lorsque Swift est compilГ©, il crГ©e simplement un NSDictionary, mais les dictionnaires NSDictionary et Swift ont une syntaxe diffГ©rente. Convert Dictionary to a JSON string in swift . GitHub Gist: instantly share code, notes, and snippets.

Convert Swift Dictionary to String (2) For testing and debugging I am trying to put the content of Dictionary to a String. But have no clue hows it going to achieve. Is it possible? If yes, how. Dictionary is fetched from web service so I have no idea the key values it have. I want to use the data in app. Convert Dictionary to a JSON string in swift . GitHub Gist: instantly share code, notes, and snippets.

Tuple in swift Abhimuralidharan - Medium

Convert dictionary to data swift

Encoding and Decoding in Swift raywenderlich.com. I am not sure if I am using the dictionary or the data object or both incorrectly. I m trying to get used to the switch to swift but I’m having a little trouble., 28/05/2019 · How to convert dates and times to a string using DateFormatter About the Swift Knowledge Base This is part of the Swift Knowledge Base , a free, searchable collection of solutions for common iOS questions..

Swift Set Type — Coding Explorer Blog

Type Casting — The Swift Programming Language (Swift 5.1). Swift JSON Parsing. JSON is the most commonly used format to send and receive data from the web services. The data is in the form of key-value pairs. Using Swift Dictionaries we can easily fetch the values from the keys.. In this tutorial, we’ll be parsing JSON data from a local resource file., Type Casting¶. Type casting is a way to check the type of an instance, or to treat that instance as a different superclass or subclass from somewhere else in its own class hierarchy.. Type casting in Swift is implemented with the is and as operators. These two operators provide a simple and expressive way to check the type of a value or cast a value to a different type..

28/05/2019 · Swift’s Codable protocol makes it easy to convert JSON to native Swift structs and classes – just design data types that hold the same keys and values as your JSON, then use JSONDecoder to convert. Here’s some example JSON we can work with: In other languages, similar data types are known as hashes or associated arrays. Create a new dictionary by using a dictionary literal. A dictionary literal is a comma-separated list of key-value pairs, in which a colon separates each key from its associated value, surrounded by square brackets. You can assign a dictionary literal to a variable

Swift JSON Parsing. JSON is the most commonly used format to send and receive data from the web services. The data is in the form of key-value pairs. Using Swift Dictionaries we can easily fetch the values from the keys.. In this tutorial, we’ll be parsing JSON data from a local resource file. NSData and its mutable subclass NSMutable Data provide data objects, or object-oriented wrappers for byte buffers. Data objects let simple allocated buffers (that is, data with no embedded pointers) take on the behavior of Foundation objects. The size of the data is subject to a theoretical limit of about 8 exabytes (1 EB = 10¹⁸ bytes; in practice, the limit should not be a factor).

Tuple is a group of different values represented as one . According to apple, a tuple type is a comma-separated list of zero or more types, enclosed in parentheses. It’s a miniature version of a… from - swift json to dictionary Convertir le dictionnaire NSDictionary en swift (2) Maintenant, je sais que lorsque Swift est compilé, il crée simplement un NSDictionary, mais les dictionnaires NSDictionary et Swift ont une syntaxe différente.

Convert Swift Dictionary to String (2) For testing and debugging I am trying to put the content of Dictionary to a String. But have no clue hows it going to achieve. Is it possible? If yes, how. Dictionary is fetched from web service so I have no idea the key values it have. I want to use the data in app. [Updated to Swift 2.0 9/10/2015 SJL] I wrote early in my Swift tutorials a simple example of a dictionary But I really didn’t go too deep into all the ways one can use a dictionary. In this lesson we’ll bring everyone up to speed in using dictionaries, and for those who don’t know what a dictionary is, we’ll introduce them.

- Add item to dictionary - Check if 2 dictionaries are equal - Check if object is a dictionary - Create an empty dictionary - Get array of keys in dictionary - Get array of values in dictionary - Get dictionary value for key - Get the size of a dictionary - Loop through dictionary - Remove all items from dictionary - Remove item from dictionary Home » Blog » App Development » Working With Codable And JSON In Swift. Working With Codable And JSON In Swift Written by Reinder de Vries on August 11 2019 in App Development. You can use Codable in Swift to encode and decode custom data formats, such as JSON, to native Swift objects. It’s incredibly easy to map Swift objects to JSON data, and vice versa, simply by adopting the Codable

Swift 4 dictionaries use unique identifier known as a key to store a value which later can be referenced and looked up through the same key. Unlike items in an array, items in a dictionary do not have a specified order. You can use a dictionary when you need to look up values based on their identifiers. What is a Dictionary Dictionaries and arrays make up the collection types of Swift. Collections are exactly what they say: a collection of values. The difference between an array and a dictionary is how you get the values in and out of the collection. Arrays, as we covered …

The first two examples of dictionary creation may look familiar as these are Swift 3, Xcode 8 supported methods for dictionary creation. The first creates a new mutable dictionary type with a string definition as the key and value. After the dictionary is created on line 6 the subscript syntax is used to explicitly assign a value to a key. Tuple is a group of different values represented as one . According to apple, a tuple type is a comma-separated list of zero or more types, enclosed in parentheses. It’s a miniature version of a…

15/07/2019 · You’ll also need to convert the saved data sent over the network to a suitable format before using it in your app. This reverse process is called decoding or deserialization. In this tutorial, you’ll learn all you need to know about encoding and decoding in Swift by managing your very own toy store. You’ll explore the following topics This Swift code example will demonstrate how to convert JSON String to NSDictionary in Swift 2 and Swift 3. Convert JSON String to NSDictionary – Example in Swift 2 let jsonText = "{\"first_name\":\"Sergey\"}" var dictonary:NSDictionary? if let data = jsonText.dataUsingEncoding(NSUTF8StringEncoding) { do { dictonary = try NSJSONSerialization.JSONObjectWithData(data…

The NSDictionary class declares the programmatic interface to objects that manage immutable associations of keys and values. For example, an interactive form could be represented as a dictionary, with the field names as keys, corresponding to user-entered values. [Updated to Swift 2.0 9/10/2015 SJL] I wrote early in my Swift tutorials a simple example of a dictionary But I really didn’t go too deep into all the ways one can use a dictionary. In this lesson we’ll bring everyone up to speed in using dictionaries, and for those who don’t know what a dictionary is, we’ll introduce them.

There’s also .nulTerminatedUTF8, which does the same thing, but then adds a nul-character to the end if your plan is to pass this somewhere as a C string (though if you’re doing that, you can probably also use .withCString or just use the implicit conversion for bridged C functions. Questions: I want to convert my Dictionary> to JSON string. Does anyone know how to achieve this in C#? Answers: Serializing data structures containing only numeric or boolean values is fairly straightforward. If you don’t have much to serialize, you can write a method for your specific type. For a Dictionary> as you have

Swift JSON Parsing. JSON is the most commonly used format to send and receive data from the web services. The data is in the form of key-value pairs. Using Swift Dictionaries we can easily fetch the values from the keys.. In this tutorial, we’ll be parsing JSON data from a local resource file. 28/05/2019 · Swift’s Codable protocol makes it easy to convert JSON to native Swift structs and classes – just design data types that hold the same keys and values as your JSON, then use JSONDecoder to convert. Here’s some example JSON we can work with:

15/07/2019 · You’ll also need to convert the saved data sent over the network to a suitable format before using it in your app. This reverse process is called decoding or deserialization. In this tutorial, you’ll learn all you need to know about encoding and decoding in Swift by managing your very own toy store. You’ll explore the following topics You use the JSONSerialization class to convert JSON to Foundation objects and convert Foundation objects to JSON.. A Foundation object that may be converted to JSON must have the following properties: The top level object is an NSArray or NSDictionary.. All objects are instances of NSString, NSNumber, NSArray, NSDictionary, or NSNull.. All dictionary keys are instances of NSString.

Codable Protocol. The new protocol introduced by Apple in Swift 4 provides built-in Encodable and Decodable features. It makes JSON parsing easier. It can convert itself into and out of an I am not sure if I am using the dictionary or the data object or both incorrectly. I m trying to get used to the switch to swift but I’m having a little trouble.

Encoding and Decoding in Swift raywenderlich.com

Convert dictionary to data swift

How to Use Dictionaries in Swift 3.0 – Make App Pie. Being able to convert JSON from object to string and vice versa is useful for transferring and storing data. JSON.stringify() The JSON.stringify() function converts an object to a JSON string. Strings are useful for transporting data from a client to a server through storing or passing information in a lightweight way. For example, you may, Swift Dictionary Examples Use a dictionary to look up values from keys. Add elements and loop over tuples with for-in. Dictionary. In our memory we link keys to values. A snake is a reptile. A frog is an amphibian. Our memory is a form of key-value storage. A Swift Dictionary is a primary collection type. We use special syntax to specify key and value types. We add pairs with assignment. An.

JSONSerialization Foundation - Apple Developer

Convert dictionary to data swift

from swift json to dictionary - Code Examples. Swift JSON Parsing. JSON is the most commonly used format to send and receive data from the web services. The data is in the form of key-value pairs. Using Swift Dictionaries we can easily fetch the values from the keys.. In this tutorial, we’ll be parsing JSON data from a local resource file. Being able to convert JSON from object to string and vice versa is useful for transferring and storing data. JSON.stringify() The JSON.stringify() function converts an object to a JSON string. Strings are useful for transporting data from a client to a server through storing or passing information in a lightweight way. For example, you may.

Convert dictionary to data swift


Home » Blog » App Development » Working With Codable And JSON In Swift. Working With Codable And JSON In Swift Written by Reinder de Vries on August 11 2019 in App Development. You can use Codable in Swift to encode and decode custom data formats, such as JSON, to native Swift objects. It’s incredibly easy to map Swift objects to JSON data, and vice versa, simply by adopting the Codable There’s also .nulTerminatedUTF8, which does the same thing, but then adds a nul-character to the end if your plan is to pass this somewhere as a C string (though if you’re doing that, you can probably also use .withCString or just use the implicit conversion for bridged C functions.

01/06/2014В В· The reason is if you add a key LATER that happens to match a binding. I.e. if the app is started with a set of bindings to keys in the dictionary, and you at some later point populate those keys from some async data source that comes down after the app is up. 15/02/2017В В· If you are using Alamofire for networking and you want to convert your responses to Swift objects, you can use AlamofireObjectMapper. It is a simple Alamofire extension that uses ObjectMapper to automatically map JSON response data to Swift objects. ObjectMapper + Realm. ObjectMapper and Realm can be used together. Simply follow the class

Swift 4 dictionaries use unique identifier known as a key to store a value which later can be referenced and looked up through the same key. Unlike items in an array, items in a dictionary do not have a specified order. You can use a dictionary when you need to look up values based on their identifiers. This Swift code example will demonstrate how to convert JSON String to NSDictionary in Swift 2 and Swift 3. Convert JSON String to NSDictionary – Example in Swift 2 let jsonText = "{\"first_name\":\"Sergey\"}" var dictonary:NSDictionary? if let data = jsonText.dataUsingEncoding(NSUTF8StringEncoding) { do { dictonary = try NSJSONSerialization.JSONObjectWithData(data…

In other languages, similar data types are known as hashes or associated arrays. Create a new dictionary by using a dictionary literal. A dictionary literal is a comma-separated list of key-value pairs, in which a colon separates each key from its associated value, surrounded by square brackets. You can assign a dictionary literal to a variable The NSDictionary class declares the programmatic interface to objects that manage immutable associations of keys and values. For example, an interactive form could be represented as a dictionary, with the field names as keys, corresponding to user-entered values.

28/05/2019В В· How to convert dates and times to a string using DateFormatter About the Swift Knowledge Base This is part of the Swift Knowledge Base , a free, searchable collection of solutions for common iOS questions. 19/09/2019В В· How to convert a String to an Int. Swift version: 5.1. Paul Hudson @twostraws September 19th 2019. If you have an integer hiding inside a string, you can convert between the two just by using the integer's initializer, like this:

Swift 4 dictionaries use unique identifier known as a key to store a value which later can be referenced and looked up through the same key. Unlike items in an array, items in a dictionary do not have a specified order. You can use a dictionary when you need to look up values based on their identifiers. You use the JSONSerialization class to convert JSON to Foundation objects and convert Foundation objects to JSON.. A Foundation object that may be converted to JSON must have the following properties: The top level object is an NSArray or NSDictionary.. All objects are instances of NSString, NSNumber, NSArray, NSDictionary, or NSNull.. All dictionary keys are instances of NSString.

Convert Swift Dictionary to String (2) For testing and debugging I am trying to put the content of Dictionary to a String. But have no clue hows it going to achieve. Is it possible? If yes, how. Dictionary is fetched from web service so I have no idea the key values it have. I want to use the data in app. In other languages, similar data types are known as hashes or associated arrays. Create a new dictionary by using a dictionary literal. A dictionary literal is a comma-separated list of key-value pairs, in which a colon separates each key from its associated value, surrounded by square brackets. You can assign a dictionary literal to a variable

View all posts in Banyo category